Learn R Programming

icd (version 4.0.6)

comorbid_pccc_dx: Calculate pediatric complex chronic conditions (PCCC) comorbidities

Description

Unlike with ICD-9 and ICD-10 diagnostic codes, 'icd' doesn't currently have a method for guessing which fields are procedure codes, so icd_name must be specified for the _pcs functions.

Usage

comorbid_pccc_dx(x, visit_name = get_visit_name(x),
  icd_name = get_icd_name(x), short_code = guess_short(x, icd_name =
  icd_name), return_df = FALSE, return_binary = FALSE, ...)

comorbid_pccc_pcs(x, visit_name = get_visit_name(x), icd_name, return_df = FALSE, return_binary = FALSE, ...)

icd9_comorbid_pccc_dx(x, visit_name = NULL, icd_name = NULL, short_code = guess_short(x, icd_name = icd_name), return_df = FALSE, return_binary = FALSE, ..., abbrev_names = TRUE)

icd10_comorbid_pccc_dx(x, visit_name = NULL, icd_name = NULL, short_code = guess_short(x, icd_name = icd_name), return_df = FALSE, return_binary = FALSE, ..., abbrev_names = TRUE)

icd9_comorbid_pccc_pcs(x, visit_name = get_visit_name(x), icd_name = get_icd_pc_name(x), return_df = FALSE, return_binary = FALSE, ..., abbrev_names = TRUE)

icd10_comorbid_pccc_pcs(x, visit_name = get_visit_name(x), icd_name, return_df = FALSE, return_binary = FALSE, ..., abbrev_names = TRUE)

Arguments

x

data.frame containing a column of patient-visit identifiers and a column of ICD codes. The data.frame may be in ‘long’ or ‘wide’ format, like the example vermont_dx and uranium_pathology data.

visit_name

The name of the column in the data frame which contains the patient or visit identifier. Typically this is the visit identifier, since patients come leave and enter hospital with different ICD-9 codes. It is a character vector of length one. If left empty, or NULL, then an attempt is made to guess which field has the ID for the patient encounter (not a patient ID, although this can of course be specified directly). The guesses proceed until a single match is made. Data frames may be wide with many matching fields, so to avoid false positives, anything but a single match is rejected. If there are no successful guesses, and visit_id was not specified, then the first column of the data frame is used.

icd_name

The name of the column in the data.frame which contains the ICD codes. This is a character vector of length one. If it is NULL, icd9 will attempt to guess the column name, looking for progressively less likely possibilities until it matches a single column. Failing this, it will take the first column in the data frame. Specifying the column using this argument avoids the guesswork.

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.

return_df

single logical value, if TRUE, return 'tidy' data, i.e., the result is a data frame with the first column being the visit_id, and the second being the count. If visit_id was a factor or named differently in the input, this is preserved.

return_binary

Single logical value, if TRUE, the returned matrix or data.frame will be composed of 1 and 0, instead of TRUE and FALSE, respectively. This conversion can also be done by the internal functions icd:::logical_to_binary and icd:::binary_to_logical, or using other tools, e.g. apply(x, 2, as.integer)

...

Arguments passed through to comorbid

abbrev_names

single logical value that defaults to TRUE, in which case the shorter human-readable names stored in e.g. ahrqComorbidNamesAbbrev are applied to the data frame column names.

Functions

  • comorbid_pccc_pcs: Calculate the PCCC comorbidities based on procedure codes,

  • icd9_comorbid_pccc_dx: Calculate PCCC comorbidities from ICD-9 diagnosis codes

  • icd10_comorbid_pccc_dx: Calculate PCCC comorbidities from ICD-10 diagnosis codes

  • icd9_comorbid_pccc_pcs: Calculate PCCC comorbidities from ICD-9 procedure codes

  • icd10_comorbid_pccc_pcs: Calculate PCCC comorbidities from ICD-10 procedure codes

See Also

Other comorbidity computations: comorbid_hcc, comorbid

Other comorbidities: comorbid_hcc, comorbid, icd10_map_ahrq_pcs, icd9_map_ahrq, icd9_map_elix, icd9_map_hcc, icd9_map_pccc, icd9_map_quan_deyo, icd9_map_quan_elix, icd9_map_single_ccs

Examples

Run this code
# NOT RUN {
# not pediatric data, but let's look for this example
head(icd9_comorbid_pccc_dx(vermont_dx))
# Six random codes from each PCCC procedure code map. 'icd' will use
# an heuristic to guess whether ICD-9 or ICD-10:
pts <- data.frame(
  encounters = c(10, 11, 12),
  icd9_pcs = c("0152", "304", "0050"),
  icd10_pcs = c("0B110Z4", "02YA0Z2", "031209D")
)
comorbid_pccc_pcs(pts, icd_name = "icd9_pcs", return_binary = TRUE)
comorbid_pccc_pcs(pts, icd_name = "icd10_pcs", return_binary = TRUE)

# All ICD-9 procedure codes are numeric, some ICD-10 procedure codes
# are numeric, so best to call functions directly:
pts <- data.frame(encounters = c(100), icd10_pcs = c("0016070"))
icd10_comorbid_pccc_pcs(pts, icd_name = "icd10_pcs")
# }

Run the code above in your browser using DataLab