我有一个数据框,我对其进行了两次方差分析。
dput(m3)
结构(list(Delta = c(-40,-40,-40,-40,-31.7,-29.3,-27.8, -26.7,-26.2,-25.4,-24.7,-23.1,-23,-22.9,-22.4,-22.2, -21.4,-21,-20.8,-15.1,-14.9,-14.1,-6.2,-6.2,-6,-5.3, -4.9),位置=结构(c(1L,1L,1L,1L,1L,2L,2L,2L, 1L,2L,2L,1L,2L,1L,1L,1L,2L,1L,2L,2L,1L,2L,3L,2L, 3L,3L,3L),.Label = c(“ int”,“ pen + int”,“ ter + pen”),class =“ factor”), 之间= c(0L,1L,1L,2L,1L,1L,1L,2L,0L,2L,1L,0L, 1L,0L,2L,0L,2L,1L,1L,1L,1L,0L,0L,0L,0L,0L,0L ),相对=结构(c(5L,6L,6L,7L,8L,3L,3L,4L, 5L,4L,3L,5L,3L,5L,7L,5L,4L,6L,3L,3L,6L,2L,1L, 2L,1L,1L,1L),.Label = c(“ 1&2”,“ 2&3”,“ 2&4”,“ 2&5”,“ 3&4”, “ 3&5”,“ 3&6”,“ 4&6”),class =“ factor”)),class =“ data.frame”,row.names = c(NA, -27L))
library(agricolae)
aov.2sum=aov(Delta.~Location*X.between, data=m3)
我想像使用其他具有相同功能的数据框一样,使用 HSD.test 分析数据。 我遵循以下包装手册中的代码格式。
tx <- with(m3, interaction(Location, X.between))
amod <-aov(Delta~tx, data=m3)
test=HSD.test(amod, "tx", group=TRUE)
然后我收到以下错误
.rowNamesDF<-
(x,值=值)中的错误: 不允许重复的“ row.names” 另外:警告消息: 设置'row.names'时的非唯一值:'int.0','pen + int.1','pen + int.2','te + int.0','te + int.1'< / p>
进一步分析后,我发现重复的行名错误与X.between功能有关。当我使用以下代码时,我得到相同的重复行名错误:
HSD.test(amod, "X.between", group=TRUE)
>> Error in data.frame(row.names = means[, 1], means[, 2:6]) :
duplicate row.names: 0, 1, 2
如何为HSD.test选择行名? 那我该如何更改行名呢?还是只是避免这种重复错误?
感谢您提供的所有帮助。