generate_charlson_index_df: Calculate the Charlson Comorbidity Index

Description Usage Arguments Value See Also Examples

View source: R/icd9cm.R

Description

generate_charlson_index_df merges a data frame of Charlson comorbidities with charlson_weights and sums the results per patient.

Usage

1
2
generate_charlson_index_df(df, idvar = "id",
  weights = medicalrisk::charlson_weights)

Arguments

df

a data frame with ID column idvar and logical columns for each comorbidity, such as that generated by generate_comorbidity_df

idvar

string with name of ID variable within df

weights

defaults to charlson_weights

Value

a dataframe with two columns, idvar and "index"

See Also

generate_comorbidity_df, charlson_weights, charlson_weights_orig

Examples

1
2
3
# calculate Charlson Comorbidity Index for all patients in the \code{\link{vt_inp_sample}}
data(vt_inp_sample)
generate_charlson_index_df(generate_comorbidity_df(vt_inp_sample))

Example output

     id index
1     1     2
2     2     0
3     3     0
4     4     4
5     5     2
6     6     2
7     7     4
8     8     4
9     9     5
10   10     5
11   11     2
12   12     0
13   13     2
14   14     0
15   15     1
16   16     5
17   17     0
18   18     2
19   19     5
20   20     0
21   21     0
22   22     0
23   23     8
24   24     2
25   25     3
26   26     6
27   27     3
28   28     2
29   29     0
30   30     0
31   31     0
32   32     5
33   33     2
34   34     0
35   35     3
36   36     2
37   37     0
38   38     0
39   39     0
40   40     5
41   41     0
42   42     0
43   43     6
44   44     0
45   45     0
46   46     1
47   47     7
48   48     0
49   49     2
50   50     0
51   51     6
52   52     6
53   53     3
54   54     4
55   55     1
56   56     3
57   57     0
58   58     2
59   59     3
60   60     0
61   61     8
62   62     0
63   63     0
64   64     0
65   65     0
66   66     0
67   67     0
68   68     1
69   69     0
70   70     2
71   71     5
72   72     0
73   73     0
74   74     3
75   75     0
76   76     5
77   77     4
78   78     3
79   79     3
80   80     6
81   81     2
82   82     0
83   83     0
84   84     8
85   85     2
86   86     0
87   87     0
88   88     2
89   89     2
90   90     0
91   91     5
92   92     4
93   93     1
94   94     3
95   95     0
96   96     0
97   97     4
98   98    10
99   99     0
100 100     0

medicalrisk documentation built on May 29, 2017, 5:59 p.m.