Trying to figure out this error message on RStudio : "Error in UseMethod("cld") : no applicable method for 'cld' applied to an object of class "c('emm_list', 'list')"" I'm confused as it was working yesterday... I was able to display my ggplot with my tukey classes.

Code :

require(multcomp)
require(ggpubr)
require(multcompView)
require(car)
require(ggplot2)
require(lsmeans)
require(emmeans)

M <- read.csv("C:\\Users\\pauli\\Documents\\ISARA 5A\\MFE\\R\\Matrices\\Matrice moisson .csv", sep = ";", dec= ",")

MC <- M[M$parcelle=="Charignon ", ]

MC$distance <- factor(MC$distance, levels=c("1H","2H","6H","12H","15H"))

lm1 <- lm(prot~distance, data=MC) 

res.lm1 <-lsmeans(lm1, pairwise ~ distance,  adjust="tukey")
summary(res.lm1)

res.CLD<-cld(res.lm1, alpha=0.05, Letters=letters)
res.CLD
res.CLD<-res.CLD[res.CLD$.group!='',]

a <- ggplot(data=MC, aes(x=distance, y=prot,col=distance))+
  scale_color_brewer(palette = "Dark2")+
  scale_alpha(0.5)+
  geom_jitter(position = position_jitterdodge(jitter.width = 0), size = 1.5)+
  ylim(0, max(MC$prot)) +
  stat_summary(fun.data=mean_sd, size=0.2, col="black")+
  labs(title = "Parcelle blé dur - CHA", x= "Distance", y="Taux de protéines (%)")+
  theme(legend.position = "none")+
  geom_text(data = res.CLD, aes(x=res.CLD$x, y =10, label=res.CLD$Letters), col="black" ,vjust=0, size=5)
a

I'm trying to get classes from the tukey test and display them on my ggplot.

0

There are 0 best solutions below