Temporarily sets and restores the option icd.icd10cm_active_year, analogous to functions in withr.

with_icd10cm_version(ver, code)

Arguments

ver

Character vector of length one: the version of ICD-10-CM to use, corresponding to the suffix of the data.frame name, e.g., for 2019 ICD-10-CM, use "icd10cm2019" for Dutch 2014 ICD-CM translations, use "icd10cm2014_nl"

code

Code block to execute, may be in braces, or a single statement without braces.

Examples

icd:::.show_options()
#> $icd.cache #> [1] "/home/jack/.cache/R/icd" #> #> $icd.offline #> [1] FALSE #> #> $icd.who_url #> [1] "https://icd.who.int/browse10" #>
with_icd10cm_version("2014", icd:::.show_options())
#> $icd.cache #> [1] "/home/jack/.cache/R/icd" #> #> $icd.icd10cm_active_year #> [1] "2014" #> #> $icd.offline #> [1] FALSE #> #> $icd.who_url #> [1] "https://icd.who.int/browse10" #>