1

I am trying to create a list of ICD 10-CM codes that I can analyse a dataset with, and I think the best way to do this is to generate the individual codes. When I generate the codes, however, it doesn't include the decimals for whole numbers, which is an issue for the str_detect part that comes next.

I have tried to do this

complex_chronic <- c("G90.1", paste("Q", seq(00.0, 00.2, 0.01), sep = ""),
                     paste("Q", round(seq(01.0, 01.9, 0.01), digits = 2), sep = ""), "Q02",
                     paste("Q", signif(seq(03.0, 07.9, 0.01), digits = 3), sep = ""),
                     paste("F", seq(71.0, 73.9, 0.01), sep = ""))

and none of these methods work, instead returning the values as whole numbers i.e. "Q1" vs "Q1.00".

Does anyone have an idea of how to fix this, or alternatively, a better way to search a list of ICD 10-CM codes, such as using the package icd (I couldn't figure out how to do this)?

arnold-c
  • 337
  • 2
  • 13
  • The [icd](https://cran.r-project.org/package=icd) CRAN package will help you. – Jack Wasey Apr 10 '19 at 22:05
  • You seem to want codes that are not in ICD-10-CM (US) or the WHO ICD-10 scheme. `icd::short_to_decimal(icd::children(as.icd10cm(c(paste0("Q", sprintf("0%d", 1:7)), "F71", "F72", "F73"))))` or for WHO in the development version of icd: `icd::children(as.icd10who(c(paste0("Q", sprintf("0%d", 1:7)), "F71", "F72", "F73")))`. – Jack Wasey Apr 10 '19 at 22:11
  • You should also check the comorbidity maps that are included. E.g. does `icd::icd10_map_pccc_dx`, esp in the congential or genetic group help? – Jack Wasey Apr 10 '19 at 22:12
  • Hi @JackWasey, that works perfectly. If you put it as an answer I can accept it! Thanks, – arnold-c Apr 17 '19 at 16:02
  • unable, because marked as duplicate. glad it works for you. – Jack Wasey Apr 18 '19 at 14:13

0 Answers0