This is my first question here, so I hope I am formatting correctly. I am trying to run a Tukey's test following an ANOVA and keep getting an error.
ANOVA:
res.aov_distance <- aov(distance ~ sleep_category, data = sleep_analysis)
Result:
Df Sum Sq Mean Sq F value Pr(>F)
sleep_category 1 177 177.09 21.2 5.62e-06 ***
Residuals 387 3233 8.35
Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1
When I run the Tukey's test prompt after this, I get an error message:
TukeyHSD(res.aov_distance)
Error message:
TukeyHSD(res.aov_distance)
Error in TukeyHSD.aov(res.aov_distance) : no factors in the fitted model
In addition: Warning message:
In replications(paste("~", xx), data = mf) :
non-factors ignored: sleep_category
I don't understand this because the factor in the ANOVA was sleep category, and the ANOVA ran fine.
I'm new and tried to reprex to post here, but got an error. I'm hoping this is a common problem that someone recognizes. Thank you.