【发布时间】:2021-03-12 10:07:16
【问题描述】:
我有以下数据集(示例)
head(LK)
Weight question result
15 0.9633132 x1 Yes
16 1.0327943 x1 Yes
19 1.0002033 x1 Yes
20 0.9438802 x1 Yes
24 0.8067644 x1 No
49 0.8951687 x1 No
当我将 wtd.table 函数用于单向表时,它运行良好
wtd.table(LK$result, weights=LK$Weight)
$x
[1] "No" "Yes"
$sum.of.weights
[1] 747.2105 1996.9381
但是,当我尝试将其用于双向表时 - 我收到此错误:
wtd.table(LK$result, LK$question, weights=LK$Weight)
Error in match.arg(type) : 'arg' must be NULL or a character vector
我看到了使用这种语法的双向加权表的示例,因此不确定问题出在哪里。任何帮助表示赞赏。
【问题讨论】:
-
wtd.table函数来自哪个包? -
“调查”我认为