jackwasey / icd

Fast ICD-10 and ICD-9 comorbidities, decoding and validation in R. NB use main instead of master for default branch.
https://jackwasey.github.io/icd/
GNU General Public License v3.0
242 stars 60 forks source link

short_code argument to expand_range doesn't work for ICD10 #194

Open teng-gao opened 4 years ago

teng-gao commented 4 years ago

I installed the latest CRAN package. R version 3.5.0

Screen Shot 2020-03-18 at 2 01 47 PM

patrickmdnet commented 4 years ago

"C81" and "C96" are both valid short and decimal codes. The "short_code" parameter refers to the input, not the output. So what you observe is the expected behavior.

If you want the range to return decimal codes use short_to_decimal:

> short_to_decimal(expand_range("C81", "C81"))
 [1] "C81"    "C81.0"  "C81.00" "C81.01" "C81.02" "C81.03" "C81.04" "C81.05" "C81.06" "C81.07"
[11] "C81.08" "C81.09" "C81.1"  "C81.10" "C81.11" "C81.12" "C81.13" "C81.14" "C81.15" "C81.16"
[21] "C81.17" "C81.18" "C81.19" "C81.2"  "C81.20" "C81.21" "C81.22" "C81.23" "C81.24" "C81.25"
[31] "C81.26" "C81.27" "C81.28" "C81.29" "C81.3"  "C81.30" "C81.31" "C81.32" "C81.33" "C81.34"
[41] "C81.35" "C81.36" "C81.37" "C81.38" "C81.39" "C81.4"  "C81.40" "C81.41" "C81.42" "C81.43"
[51] "C81.44" "C81.45" "C81.46" "C81.47" "C81.48" "C81.49" "C81.7"  "C81.70" "C81.71" "C81.72"
[61] "C81.73" "C81.74" "C81.75" "C81.76" "C81.77" "C81.78" "C81.79" "C81.9"  "C81.90" "C81.91"
[71] "C81.92" "C81.93" "C81.94" "C81.95" "C81.96" "C81.97" "C81.98" "C81.99"