Expand ICD codes to all possible sub-codes, optionally limiting to those codes which are defined or billable (leaf nodes).

children(x, ...)

# S3 method for character
children(x, ...)

# S3 method for icd9cm
children(x, short_code = guess_short(x), defined = TRUE, billable = FALSE, ...)

# S3 method for icd9
children(x, short_code = guess_short(x), defined = TRUE, billable = FALSE, ...)

# S3 method for icd10
children(x, short_code = guess_short(x), defined, billable = FALSE, ...)

# S3 method for icd10cm
children(x, short_code = guess_short(x), defined, billable = FALSE, ...)

# S3 method for icd10who
children(
  x,
  short_code = guess_short(x),
  defined,
  billable = NULL,
  leaf = NULL,
  ...
)

Arguments

x

data, e.g. character vector of ICD codes.

...

arguments passed on to other functions

short_code

single logical value which determines whether the ICD-9 code provided is in short (TRUE) or decimal (FALSE) form. Where reasonable, this is guessed from the input data.

defined

single logical value, whether returned codes should only include those which have definitions. Definition is based on the ICD version being used, e.g. ICD-9-CM, the WHO version of ICD-10, or other.

billable

single logical value, identical to 'leaf'. Leaf is preferred as most adaptations of WHO ICD codes are not oriented around money.

leaf

single logical value, whether to limit return codes also by whether they are billable, i.e. leaf nodes. This is really only designed for use with ICD-9-CM, ICD-10-CM etc, since the WHO versions are not designed for billing, but for public health and death reporting.

Value

Returns a vector of ICD codes, with class of character and the class of the identified or specified ICD code, e.g. icd9

Methods (by class)

  • character: Get child codes, guessing ICD version and short versus decimal format

  • icd9cm: Get children of ICD-9-CM codes

  • icd9: Get children of ICD-9 codes, based on the super-set ICD-9-CM at present

  • icd10: Get children of ICD-10 codes (warns because this only applies to ICD-10-CM for now).

  • icd10cm: Get children of ICD-10-CM codes

  • icd10who: Get children of ICD-10-CM codes

See also

Other ICD-9 ranges: condense(), expand_range()

Examples

# N.b. magrittr not required by icd library(magrittr, warn.conflicts = FALSE, quietly = TRUE) # no children other than self children("10201", short_code = TRUE, defined = FALSE)
#> [1] "10201"
# guess it was ICD-9 and a short, not decimal code children("0032")
#> [1] "0032" "00320" "00321" "00322" "00323" "00324" "00329"
# empty because 102.01 is not meaningful children("10201", short_code = TRUE, defined = TRUE)
#> character(0)
x <- children("003", short_code = TRUE, defined = TRUE) explain_code(x, condense = FALSE, short_code = TRUE)
#> [1] "Other salmonella infections" #> [2] "Salmonella gastroenteritis" #> [3] "Salmonella septicemia" #> [4] "Localized salmonella infections" #> [5] "Localized salmonella infection, unspecified" #> [6] "Salmonella meningitis" #> [7] "Salmonella pneumonia" #> [8] "Salmonella arthritis" #> [9] "Salmonella osteomyelitis" #> [10] "Other localized salmonella infections" #> [11] "Other specified salmonella infections" #> [12] "Salmonella infection, unspecified"
children(short_code = FALSE, "100.0")
#> [1] "100.0"
children(short_code = FALSE, "100.00")
#> character(0)
children(short_code = FALSE, "2.34")
#> character(0)