Calculate pediatric complex chronic conditions (PCCC) comorbidities
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, ...)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, ...)
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, ...)
icd9_comorbid_pccc_pcs(x, map, visit_name, icd_name, return_df = FALSE,
return_binary = FALSE)
icd10_comorbid_pccc_pcs(x, map, visit_name, icd_name, return_df = FALSE,
return_binary = FALSE)
data.frame
containing a column of patient-visit identifiers
and a column of ICD codes. The data.frame
should be in ‘long’
format, like the example vermont_dx
data. If it is in ‘wide’
format, it must be converted to ‘long’ using
wide_to_long
before calling any comorbidity functions.
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.
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.
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.
single logical value, if TRUE
, return the result as 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.
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 on to other functions
list of the comorbidities with each list item containing a vector
of decimal ICD-9 codes. This is in the form of a list, with the names of
the items corresponding to the comorbidities (e.g. ‘HTN’, or
‘diabetes’) and the contents of each list item being a character
vector of short-form (no decimal place, zero left-padded) ICD codes. There
is no default: the user should use the family of functions, e.g.
comorbid_ahrq
, since these also name the fields correctly, apply any
hierarchical rules (see hierarchy
below)
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
# NOT RUN {
# not pediatric data, but let's look for this example
head(icd9_comorbid_pccc_dx(wide_to_long(vermont_dx)))
# }
Run the code above in your browser using DataLab