I need to create a table with data from a complex survey (with weights). Which function can be used to produce a table where we have for example one categorical variable in column, two or three categorical variables in row. Next, display the percentages (proportions) of another dichotomous variable in the table cells.
What package can I use?
https://cdcgov.github.io/surveytable/
In your data frame, be sure that categorical variables are stored as
factor. Then, convert it to a survey object using a command like this:If your survey has other attributes, such as clusters and strata, you need to specify those in this command as well.
Then, you can create tables very easily like so:
and so on. See here for an intro: https://cdcgov.github.io/surveytable/articles/surveytable.html