Description Usage Arguments Details Examples
RcppParallel approach to comorbidity assignment with OpenMP and vector of integers strategy. It is very fast, and most time is now spent setting up the data to be passed in.
This is the main function which extracts co-morbidities from a
set of ICD-9 codes. This is when some trivial post-processing of the
comorbidity data is done, e.g. renaming to human-friendly field names, and
updating fields according to rules. The exact fields from the original
mappings can be obtained using applyHierarchy = FALSE
, but for
comorbidity counting, Charlson Score, etc., the rules should be applied.
For Charlson/Deyo comorbidities, strictly speaking, there is no dropping of more e.g. uncomplicated DM if complicated DM exists, however, this is probaably useful, in general and is essential when calculating the Charlson score.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | icd9ComorbidShortCpp(icd9df, icd9Mapping, visitId, icd9Field, threads = 8L,
chunkSize = 256L, ompChunkSize = 1L, aggregate = TRUE)
icd9Comorbid(icd9df, icd9Mapping, visitId = NULL, icd9Field = NULL,
isShort = icd9GuessIsShort(icd9df[1:100, icd9Field]),
isShortMapping = icd9GuessIsShort(icd9Mapping), return.df = FALSE, ...)
icd9ComorbidShort(...)
icd9ComorbidAhrq(..., abbrevNames = TRUE, applyHierarchy = TRUE)
icd9ComorbidQuanDeyo(..., abbrevNames = TRUE, applyHierarchy = TRUE)
icd9ComorbidQuanElix(..., abbrevNames = TRUE, applyHierarchy = TRUE)
icd9ComorbidElix(..., abbrevNames = TRUE, applyHierarchy = TRUE)
icd9Comorbidities(...)
icd9ComorbiditiesAhrq(...)
icd9ComorbiditiesElixHauser(...)
icd9ComorbiditiesQuanDeyo(...)
icd9ComorbiditiesQuanElixhauser(...)
|
icd9df |
data frame containing columns for visitId (which is the feault name), icd9 (default for the icd9 code), and maybe also a POA flag. |
icd9Mapping |
list (or name of a list if character vector of length one
is given as argument) of the comorbidities with each top-level list item
containing a vector of decimal ICD9 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 but ideally zero left-padded) ICD-9 codes.
No default: user should prefer to use the derivative functions, e.g.
icd9ComorbidAhrq, since these also provide appropriate naming for the
fields, and squashing the hierarchy (see |
visitId |
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 |
icd9Field |
The column in the data frame which contains the ICD codes.
This is a character vector of length one. If it is |
aggregate |
single logical value, if /codeTRUE, then take (possible much) more time to aggregate
out-of-sequence visit IDs in the icd9df data.frame. If this is |
isShort |
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. |
isShortMapping |
Same as isShort, but applied to |
... |
arguments passed to the corresponding function from the alias.
E.g. all the arguments passed to |
abbrevNames |
single locical value that defaults to |
applyHierarchy |
single logical value that defaults to |
There is a change in behavior from previous versions. The visitId
column is (implicitly) sorted by using std::set container. Previously, the
visitId output order was whatever R's aggregate
produced.
The threading of the C++ can be controlled using e.g.
option(icd9.threads = 4)
. If it is not set, the number of cores in
the machine is used.
1 2 3 | pts <- data.frame(visitId = c("2", "1", "2", "3", "3"),
icd9 = c("39891", "40110", "09322", "41514", "39891"))
icd9ComorbidShort(pts, ahrqComorbid) # visitId is now sorted
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.