I have a problem with svyby function, because in the result I want to print all values, but svyby automatically delete all NAs.
result <- svyby(formula = pop, by=~col1+col2, FUN=svytotal, design = mydesign, na.rm.all = TRUE)
How to print all the values even with 0?
UPDATE:
I found a solution by adding parameter drop.empty.groups = FALSE
Followup: svyby
does not delete NA
s but it does (by default) delete groups that have no observations. You can use drop.empty.groups=FALSE
to report the value (which will probably be NA
) even for groups with no observations.