Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expand_range doesn't work for certain chapters #214

Open
zx8754 opened this issue Jan 29, 2023 · 1 comment
Open

expand_range doesn't work for certain chapters #214

zx8754 opened this issue Jan 29, 2023 · 1 comment

Comments

@zx8754
Copy link

zx8754 commented Jan 29, 2023

See below:

# R version 4.2.2 (2022-10-31 ucrt)
# icd_4.0.9.9000
library(icd)
#get subchapters
sub_chap <- icd10_sub_chapters

This subchapter expands for range_major but not range: Disorders Of Thyroid Gland

x <- unlist(sub_chap[51])
# Disorders Of Thyroid Gland.start 
# "E00" 
# Disorders Of Thyroid Gland.end 
# "E07"
expand_range(x[1], x[2])
# Error in icd9_expand_range_short(start, end, defined, ex_ambig_start,  : 
#  is_defined(start, short_code = TRUE) is not TRUE

expand_range_major(x[1], x[2])
# [1] "E000" "E001" "E002" "E003" "E004" "E005" "E006" "E007"

This subchapter doesn't expand, gives same error: Pedestrian Injured In Transport Accident

x <- unlist(sub_chap[239])
# Pedestrian Injured In Transport Accident.start 
# "V00" 
# Pedestrian Injured In Transport Accident.end 
# "V09" 
expand_range(x[1], x[2])
expand_range_major(x[1], x[2])
# Error in guess_pair_version(start = start, end = end, short_code = short_code) : 
#   Cannot expand range because ICD code version cannot be guessed from V00 and V09. Either specify the classes, e.g. icd9("100.4"), or call the
# S3 method directly, e.g. expand_range.icd9
@jsavinc
Copy link

jsavinc commented Jun 9, 2023

Hi, I think this is due to codes prefixed with E- and V- are also valid codes in ICD-9. Have you tried specifying the ICD version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants