Add Post hoc result letters (from SNK.test) to boxplots

Hi, I am a new R user. After doing two way ANOVA, I did the SNK post hoc test to see the significance among treatments. However, I could not put the letter on the boxplot. Could anyone help me with that problem?

I am also sharing my code:

#compare the treatments different ages
model <- glm(Responses~Treatments,data=subset (data, Age=="Early Age"), family = "gaussian")
SNK.test(model, "Treatment",console = T)
model <- glm(Responses~Treatments,data=subset (data, Age=="Middle Age"), family = "gaussian")
SNK.test(model, "Treatment",console = T)
model <- glm(Responses~Treatments,data=subset (data, Age=="Old Age"), family = "gaussian")
SNK.test(model, "Treatment",console = T)

View(SNK.test(model, "Treatment",console = T))

##plot data


library(ggplot2)
install.packages("RColorBrewer")
library(RColorBrewer)
# Box plot
theme<- theme_bw() + 
  theme(panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        axis.line = element_line(colour = "black"))

p<-ggplot(data=data, aes(x=Treatments, y=Responses, fill=Treatments)) +
  geom_boxplot() +facet_grid(~Age) + theme


p + scale_fill_brewer(palette = "RdBu") +labs (x="Treatments", y="Responses (mV)")

What I need to add to get Post hoc result letters (from SNK.test) to boxplots????

Hi!

To help us help you, could you please turn this into a proper reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.