5 Simple and Stratified Descriptive Tables

Using the furniture::table1() function

The table1() function in the furniture package returns a much smaller listing of summary statistics (Barrett, Brignone, and Laxman 2020).

  • Categorical Variables: count (percentage) within each category
  • Continuous Variables: mean (standard deviation)

5.1 For a Single Categorical Variable


---------------------------------
               Mean/Count (SD/%)
               n = 100          
 majorF                         
    Psychology 29 (29%)         
    Premed     25 (25%)         
    Biology    21 (21%)         
    Sociology  15 (15%)         
    Economics  10 (10%)         
---------------------------------

5.2 For a Single Continuous Variable


----------------------------
          Mean/Count (SD/%)
          n = 100          
 statquiz                  
          6.9 (1.7)        
----------------------------

5.3 For a Subset of Variables

The variables desired can also be listed inside the function (selarate with commas).


----------------------------
          Mean/Count (SD/%)
          n = 25           
 age                       
          59.6 (12.9)      
 weighin                   
          178.3 (32.0)     
 stage                     
    0     1 (4%)           
    1     12 (48%)         
    2     6 (24%)          
    3     1 (4%)           
    4     5 (20%)          
 totalcin                  
          6.5 (1.5)        
----------------------------

---------------------------------------------
                           Mean/Count (SD/%)
                           n = 100          
 majorF                                     
    Psychology             29 (29%)         
    Premed                 25 (25%)         
    Biology                21 (21%)         
    Sociology              15 (15%)         
    Economics              10 (10%)         
 reasonF                                    
    Program requirement    41 (41%)         
    Personal interest      29 (29%)         
    Advisor recommendation 30 (30%)         
 statquiz                                   
                           6.9 (1.7)        
---------------------------------------------

5.4 Customize the Variable Labels


----------------------------------
                Mean/Count (SD/%)
                n = 25           
 Age, years                      
                59.6 (12.9)      
 Weight, pounds                  
                178.3 (32.0)     
 Cancer Stage                    
    0           1 (4%)           
    1           12 (48%)         
    2           6 (24%)          
    3           1 (4%)           
    4           5 (20%)          
 Oral Condition                  
                6.5 (1.5)        
----------------------------------

---------------------------------------------------
                                 Mean/Count (SD/%)
                                 n = 85           
 Reason For Enrolling                             
    Program requirement          33 (38.8%)       
    Personal interest            27 (31.8%)       
    Advisor recommendation       25 (29.4%)       
 Coffee Drinker                                   
    Not a regular coffee drinker 50 (58.8%)       
    Regularly drinks coffee      35 (41.2%)       
 Math Phobia                                      
                                 3.2 (2.5)        
 Statistics Quiz                                  
                                 6.8 (1.7)        
 Mathematics Quiz                                 
                                 29.1 (9.5)       
---------------------------------------------------

5.5 Stratify -by- a categorical factor

You may use a dplyr::group_by(grouping_var) step before the furniture::table1() step to create summary statistics for different subgroups.


------------------------------------------
                         trt 
                Placebo      Aloe Juice  
                n = 14       n = 11      
 Age, years                              
                59.8 (9.0)   59.5 (17.2) 
 Weight, pounds                          
                167.5 (23.0) 192.0 (37.4)
 Cancer Stage                            
    0           0 (0%)       1 (9.1%)    
    1           8 (57.1%)    4 (36.4%)   
    2           3 (21.4%)    3 (27.3%)   
    3           1 (7.1%)     0 (0%)      
    4           2 (14.3%)    3 (27.3%)   
 Oral Condition                          
                6.6 (0.9)    6.5 (2.1)   
------------------------------------------

-------------------------------------------------
                                genderF 
                           Female     Male      
                           n = 57     n = 43    
 College Major                                  
    Psychology             19 (33.3%) 10 (23.3%)
    Premed                 11 (19.3%) 14 (32.6%)
    Biology                11 (19.3%) 10 (23.3%)
    Sociology              12 (21.1%) 3 (7%)    
    Economics              4 (7%)     6 (14%)   
 Reason Enrolled                                
    Program requirement    23 (40.4%) 18 (41.9%)
    Personal interest      16 (28.1%) 13 (30.2%)
    Advisor recommendation 18 (31.6%) 12 (27.9%)
 Statistics Quiz                                
                           6.8 (1.7)  6.9 (1.7) 
-------------------------------------------------

------------------------------------------------------------
                                    phobia_cut3 
                           [0,2]      (2,4]      (4,10]    
                           n = 39     n = 37     n = 24    
 College Major                                             
    Psychology             7 (17.9%)  12 (32.4%) 10 (41.7%)
    Premed                 11 (28.2%) 9 (24.3%)  5 (20.8%) 
    Biology                7 (17.9%)  10 (27%)   4 (16.7%) 
    Sociology              7 (17.9%)  4 (10.8%)  4 (16.7%) 
    Economics              7 (17.9%)  2 (5.4%)   1 (4.2%)  
 Reason Enrolled                                           
    Program requirement    4 (10.3%)  23 (62.2%) 14 (58.3%)
    Personal interest      25 (64.1%) 3 (8.1%)   1 (4.2%)  
    Advisor recommendation 10 (25.6%) 11 (29.7%) 9 (37.5%) 
 Statistics Quiz                                           
                           7.6 (1.3)  6.6 (1.6)  6.1 (2.0) 
------------------------------------------------------------

5.6 Add a TOTAL Column


-------------------------------------------------------
                                     trt 
                Total        Placebo      Aloe Juice  
                n = 25       n = 14       n = 11      
 Age, years                                           
                59.6 (12.9)  59.8 (9.0)   59.5 (17.2) 
 Weight, pounds                                       
                178.3 (32.0) 167.5 (23.0) 192.0 (37.4)
 Cancer Stage                                         
    0           1 (4%)       0 (0%)       1 (9.1%)    
    1           12 (48%)     8 (57.1%)    4 (36.4%)   
    2           6 (24%)      3 (21.4%)    3 (27.3%)   
    3           1 (4%)       1 (7.1%)     0 (0%)      
    4           5 (20%)      2 (14.3%)    3 (27.3%)   
 Oral Condition                                       
                6.5 (1.5)    6.6 (0.9)    6.5 (2.1)   
-------------------------------------------------------

-----------------------------------------------------------
                                         genderF 
                           Total     Female     Male      
                           n = 100   n = 57     n = 43    
 College Major                                            
    Psychology             29 (29%)  19 (33.3%) 10 (23.3%)
    Premed                 25 (25%)  11 (19.3%) 14 (32.6%)
    Biology                21 (21%)  11 (19.3%) 10 (23.3%)
    Sociology              15 (15%)  12 (21.1%) 3 (7%)    
    Economics              10 (10%)  4 (7%)     6 (14%)   
 Reason Enrolled                                          
    Program requirement    41 (41%)  23 (40.4%) 18 (41.9%)
    Personal interest      29 (29%)  16 (28.1%) 13 (30.2%)
    Advisor recommendation 30 (30%)  18 (31.6%) 12 (27.9%)
 Statistics Quiz                                          
                           6.9 (1.7) 6.8 (1.7)  6.9 (1.7) 
-----------------------------------------------------------