r - using multcompLetters to add connecting letters -
i hope there has 2 minutes explain me 2 things. have code run on pretty big dataset. using multcompletters add together connecting letters boxplots. have experiment setup 4 treatments , 2 genotypes aov y ~ treat+geno+geno:treat. when run code treatment (3df) or interaction (7df) seems work quite ok time. when run on geno(here x) error.
error in multcompletters(t$x[, 1]) : names required t$x[, 1]
and cant find out why.
2nd question -
what [,4] mean in
groups2 <- multcompletters(t$x[,4])
??
the code mockup made u:
#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)
thanks.
what multcompletters
expects matrix of values, because expected more 1 comparison. in data, have 1 comparison, yes
vs no
. if within t$x
variable, can see matrix:
t$x # diff lwr upr p adj # yes-no 0.3 -1.631884 2.231884 0.747998
typically, there many rows here. unfortunately, when select 1 row matrix, of row names dropped, , multcompletters
needs names. example:
t$x[,4] # [1] 0.747998 # no names.
to prevent this, have add together parameter subselect:
t$x[,4,drop=false] # p adj # yes-no 0.747998 # names intact multcompletters(t$x[,4,drop=false]) # works. # $letters # yes-no # "a" # # $lettermatrix # # yes-no true
r
No comments:
Post a Comment