tableone icon indicating copy to clipboard operation
tableone copied to clipboard

Optional arg to calculate proportions row-wise

Open brentocarrigan opened this issue 3 years ago • 1 comments

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 avatar Sep 27 '20 22:09 brentocarrigan

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

brentocarrigan avatar Oct 12 '20 21:10 brentocarrigan