kaz-yos / tableone

R package to create "Table 1", description of baseline characteristics with or without propensity score weighting
https://cran.r-project.org/web/packages/tableone/index.html
217 stars 41 forks source link

Optional arg to calculate proportions row-wise #73

Open brentocarrigan opened 4 years ago

brentocarrigan commented 4 years ago

Fantastic package, many thanks!

Is there a way to incorporate a flag that calculates percentages row-wise, not column-wise? For example, in a cat table:


                     level  DrugA              DrugB               DrugC                  DrugD                
  n                         1021                 257                  81                   159                 
  age_cat (%)        <70    712 (69.7)           184 (71.6)           53 (65.4)            99 (62.3)           
                     >=70   309 (30.3)           73 (28.4)            28 (34.6)            60 (37.7)           

At times it can be helpful to compare row-wise - eg here the proportions/percentages of all patients <70 that were in each drug group; rather than the proportion within each drug group that were under 70.

brentocarrigan commented 4 years ago

Additional comment: I see lots of TableOne code derives from the Deducer packer, some of their functions permit an argument to specify whether you wish for calculated frequencies to sum either row-wise prop.r or column-wise prop.c - this would be a huge help, or at least allow the dots ... to pass such arguments to the underlying Deducer functions