我希望有人有2分钟的时间来解释我2件事情。我有这个代码,我运行在一个非常大的数据集上。它使用multcompLetters将连接字母添加到我的箱型图中。我有一个4治疗和2种基因型的实验设置,所以我的aov就像y〜Treat + Geno + Geno:Treat。 当我用处理(3df)或交互(7df)运行代码时,它似乎始终工作得很好。当我在Geno上运行它时(这里是x),我得到一个错误。r - 使用multcompLetters添加连接字母
Error in multcompLetters(t$x[, 1]) : Names required for t$x[, 1]
我真的找不到原因。
第二个问题 -
什么是[1,4]意味着
groups2 <- multcompLetters(t$x[,4])
?
为你使代码样机:
#RGR ~ Geno boxplot
y<-c(1,2,6,4,5,7,2,3,9,7,5,6,4,3,2,3,4,5,4,5)
x<-c("no","yes","no","yes","no","yes","no","yes","no","yes",
"no","yes","no","yes","no","yes","no","yes","no","yes")
fit <- aov(y~x)
summary(fit)
t <- TukeyHSD(aov(fit))
t
names(t)
boxplot(y~x, data=For.R, ylim=c(0,10),xlab="Some", ylab="Else")
tp <- extract_p(t)
tp
groups2 <- multcompLetters(t$x[,4])
lets <- groups2$Letters[c(4,1:3)]
text(1:4, 95 ,lets)
感谢。
看看'T $ x'。 't $ x [,4]'是第四列,'t $ x'的所有行。更好的方法是说't $ x [,'p adj']',这样它在代码中更具可读性。这是非常基本的R,所以你应该在问这里之前阅读一些教程。另外,我猜你正在使用'multcompView'包,这也应该提到。你也没有包含'For.R'的数据,我想这只是'data.frame(x = x,y = y)'。 – nograpes 2014-10-07 21:12:58