使用 svytotal() 做汇总
我们也可以用 svytotal() 来估计计数。其语法如下:
svytotal(x = ~interaction(Var1, Var2),
design = design,
na.rm = TRUE)
对两个变量的每一种组合,都会返回总量估计值及其标准误。
本练习是课程的一部分
用 R 分析调查数据
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Estimate the totals for combos of Depressed and HealthGen
tab_totals <- svy___(x = ~interaction(___, ___),
design = NHANES_design,
na.rm = TRUE)
# Print table of totals
___