I'm trying to run TukeyHSD on an anova and keep getting this error message: Error in UseMethod("TukeyHSD") : no applicable method for 'TukeyHSD' applied to an object of class "c('anova', 'data.frame')"
Can anyone tell me what this message means? I'm very new to R so any help would be appreciated! Thanks!
Script that is producing this error:
a <- data.frame(list(rep(1,100),rnorm(100,50)))
colnames(a) <- c("ID","FeretMinimum")
b <- data.frame(list(rep(2,100),rnorm(100,50)))
colnames(b) <- c("ID","FeretMinimum")
c <- data.frame(list(rep(3,100),rnorm(100,50)))
colnames(c) <- c("ID","FeretMinimum")
d <- data.frame(list(rep(4,100),rnorm(100,50)))
colnames(d) <- c("ID","FeretMinimum")
ColumnFilter = "FeretMinimum"
IDFilter = "ID"
groups <- rbind(a, b ,c ,d)
group.1 <- lm(groups[[ColumnFilter]]~groups[[IDFilter]], data=groups)
aov<- anova(group.1)
print(aov)
posthoc <- TukeyHSD(x=aov, as.factor(groups[[ColumnFilter]]), conf.level=0.95)
aov <- aov(group.1)
, but of course you'd needfactor
variables on the RHS. – Roland