1

I am new to R and would like some help on the survey function

I am using svyby function to do cross tab

for example: svyby( ~bmi,~Race, design, svymean, na.rm = TRUE) and getting the result

                                  bmi_Obese          bmi_Overweight 
Asian                                29.84146         17.155935            
Native Hawaiian/Pacific Islander     69.12672          9.839069                
NH White                             45.81656         22.619381                 
NH Black                             83.08938         23.581278               
Hispanic                             35.48914         29.117425                       
Native American/Alaskan Native       48.99318         20.636438                           
Other                                 0.00000          18.47743     

Is there a way to get the total mean column and row in svyby, below is the output i am expecting as Stata would provide the total

Asian                                29.84146         17.155935            
Native Hawaiian/Pacific Islander     69.12672          9.839069                
NH White                             45.81656         22.619381                 
NH Black                             83.08938         23.581278               
Hispanic                             35.48914         29.117425                       
Native American/Alaskan Native       48.99318         20.636438                           
Other                                 0.00000          18.47743  
**Total                                 ------           --------**

I have tried other functions inside svyby

ad9820
  • 11
  • 2

0 Answers0