Learn R Programming

icd9 (version 0.3)

lookupComorbidities: lookup pre-calculated co-morbidities for given list of visit IDs

Description

merges the data frame dat with pre-calculated icd9 comorbidities by visitId

Usage

lookupComorbidities(dat, icd9lk, visitId = "visitId", mergeFun = merge, ...)

Arguments

dat
contains the data with at least one field named by visitId, and likely a field "poa" for the present on arrival flag. Additional fields are preserved. Merging fields with duplicated visitId will behave according to default of mergeFun
icd9lk
is one of the pre-prepared lookup tables. e.g. 'comorbidAllInpt','comorbidPoaInpt','comorbidNotPoaInpt' If a character string is given (vector of unit length), then the name is used to lookup the data in current environment tree. If a data frame is given,
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. Defaults to "
mergeFun
is the function used to merge the comorbidity data with the visitId list, using visitId as the key. Can be left as default merge but this has limited ability when identical fields appear, and in how field name clashes can rename; neither does
...
additional arguments passed to mergeFun

Value

  • data.frame with input visit IDs merged with comorbidities