Let's assume the a data set mydata with the variables foo1..foo20 which are factors with the labels "Easy" and "Difficult". Now let's consider this code:
library(survey)
svd <- svydesign(ids = ~ 1, weights = ~ weight, data = mydata)
svyby(~ foo1, by = ~ group, svd, svymean)$foo1Difficult
svyby(~ foo1 + foo2 + foo3 + ... + foo20, by = ~ group, svd, svymean)$foo1Difficult
Are the results supposed to be identical? Is there a reason why the results could differ? Why does it make a difference whether I iterate over each variable or use all variables at once?
As @AnthonyDamico pointed out, the difference was caused by NAs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.