我有几个代码片段,IIRC,它们曾经可以工作,但现在会抛出错误。 为了确保我不是在编造事情,我在谷歌上搜索了样板示例,并找到了一些,例如在 STHDA:
before <-c(200.1, 190.9, 192.7, 213, 241.4, 196.9, 172.2, 185.5, 205.2, 193.7)
after <-c(392.9, 393.2, 345.1, 393, 434, 427.9, 422, 383.9, 392.3, 352.2)
my_data <- data.frame(
group = rep(c("before", "after"), each = 10),
weight = c(before, after)
)
# this works as expected:
wilcox.test(before, after, paired = TRUE)
# this as well:
wilcox.test(weight ~ group, data = my_data)
# this, however, throws an error:
wilcox.test(weight ~ group, data = my_data, paired = TRUE)
错误信息:
Error in wilcox.test.formula(weight ~ group, data = my_data, paired = TRUE) :
cannot use 'paired' in formula method
我正在使用最新的 R 版本 (
4.4.0
) 并通过 CLI 进行了尝试。
不幸的是,我现在无法尝试旧版本,所以我无法验证这是否真的有效,但由于我发现了很多这样的教程,我确信我不仅仅是在编造事情。
那么,有任何指示这里有什么问题吗?
谢谢!
此问题已记录为错误修复。请参阅
https://bugs.r-project.org/show_bug.cgi?id=14359
了解自 2010 年 8 月以来一直在进行的讨论!
此外,在R新闻页面上: