Search code examples
rsurvey

Three-way tables with survey or srvyr


I am using the 2015 BRFSS data to mimic this example this example. Getting the diabetes prevalence, etc. works with group_by() as shown in Yakota's code. However, what if I need for each state, diabetes prevalence by race?


Solution

  • i think you want

    svyby(
      ~ diabetes_yes_no_variable , 
      ~ state_variable + race_variable , 
      your_survey_design , 
      svymean 
    )