View source: R/charlsonIndex.R
charlsonIndex | R Documentation |
This function uses 19 disease categories and their weights to establish charlson index at a particular time indicated by a variable
The suggested list of Charlson definitions comes partly from Quann (Am J Epidemiol.2011 173:676-82), partly from DMCG.dk benchmarking consortium and with further minor adjustments provided by Peter Ascanius Jacobsen. It is unlikely that any international list of definitions will apply for a Danish population and the listing used should be either cited or provided in a supplement for publication. The data included in this package "charlson.codes" includes a selection of ICD8 and ICD10 codes. ICD9 has never been used in Denmark.
If there are repeats of patient id with different index date (data.date), then Charlson index is calcultated independently for each of these dates.
Note: Only cases that have at least one of the relevant diseases will be given values with this function. The remaining should manually be provided zeroes.
charlsonIndex(data,ptid='pnr',vars,data.date,charlson.date,look.back=5
,ccodes=charlson.codes)
data |
- A dataframe/table with disease codes and dates |
ptid |
- Variable defining individual |
vars |
- variables where disease codes should be searched for |
data.date |
- variable in data with date of disease |
charlson.date |
- variable defining index date for determination of charlson index |
look.back |
- numnber of years to look back from charlson.date for diseases |
ccodes |
- named list of charlson codes. Default uses list supplied by heaven |
The charlson weights and selection of disease codes are from DCMG.dk
Note: The function only calculates a charlson index for those observations where the index is at least "1". Cases with zero appears as NA and need to be converted to zero after the function.
A list with 2 data.tables - index holding charlson index and elements holding presence of each category
Christian Torp-Pedersen
require(data.table)
set.seed(211)
adm <- simAdmissionData(10)
adm[,charlson.date:=as.Date("2017-01-01")]
adm2 <- adm[1:5]
adm2[,charlson.date:=as.Date("2015-01-01")]
adm <- rbind(adm,adm2)
ci <- charlsonIndex(adm,ptid='pnr',vars='diag',data.date='inddto',
charlson.date="charlson.date")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.