我有一个大型数据集,我正在进行ANOVA分析。我不确定如何将分析的输出到我可以在Word文档中使用的表中(无需手动重新输入所有值)。
以下是我正在尝试做的一个例子:
var1 <- c("Red", "Green", "Blue", "Blue", "Red","Red", "Green", "Blue", "Blue", "Red",
"Red", "Blue", "Green", "Blue", "Red","Red", "Green", "Blue", "Blue", "Red")
var2 <- c(10, 20, 15, 32, 10, 20, 15, 32, 10, 20, 15, 32, 10, 20, 15, 32, 10, 20, 15, 32)
df <- data.frame(var1, var2)
TukeyHSD(aov(var2 ~ var1))
这会产生如下所示的输出:
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = var2 ~ var1)
$var1
diff lwr upr p adj
Green-Blue -8.25 -21.183389 4.683389 0.2580147
Red-Blue -2.75 -13.310068 7.810068 0.7848043
Red-Green 5.50 -7.433389 18.433389 0.5323260
我希望输出格式易于剪切并粘贴到Word中,其中包含标题“变量”,“差异”和“p值”。任何帮助,将不胜感激。