0
library(dplyr)
 library(tidyr)
 library(ggpmisc)
 library(jmv)
 library(Rmisc)
 library(emmeans) 
 library(multcomp)
 library(Hmisc)
 library(lattice)
 library(multcompView)
 library(agricolae)
                
     
                                
 names(data)
 data$pH 
 data$Fs<- as.factor(data$Fs)
 data$Treatments<-as.factor(data$Treatments)
 data$Pot_Inc<-as.factor(data$Pot_Inc)
                       
           
 m1 <- aov(pH ~ Fs * Treatments * Pot_Inc, data=data)
 summary(m1)
       
l1 <- emmeans(m1, list(pairwise ~ Treatments*Pot_Inc | Fs), adjust =c("tukey"))
cld(l1, Letters=letters, alpha=0.05, reversed=T)

I am trying to run the cld function to show the the significant differences. But at the end this shows: Error in UseMethod("cld") : no applicable method for 'cld' applied to an object of class "c('emm_list', 'list')". I would be very grateful, If somebody can help me

  • 1
    Why did you convert `pH` to a factor and then try to take the `log`? That is probably the problem. Analysis of variance looks at differences in the means of a numeric variable divided into groups, i.e. factors. – dcarlson Jun 27 '21 at 23:48
  • Thank you for your answer! I corrected the data. But it is not working anyway. The same function is working in the computer of my colleague in the older version of R. But not in my laptop – Shohnazar Hazratqulov Jun 28 '21 at 12:11
  • You computed you multiple comparisons with `emmeans` in the `emmeans` package which has its own function for cld (check the manual for the package), but you are trying to use the `cld` function in the `multcomp` package which is intended to be used with `glht` function in that package. – dcarlson Jun 28 '21 at 13:25
  • Thank you for your effort! But the following combination works: l1 <- emmeans(m1, "Treatments", type="response") cld(l1, Letters=letters, reversed=T) But I need the combination which is written above. The multcomp before cld I deleted – Shohnazar Hazratqulov Jun 28 '21 at 21:22
  • Use multcomp::cld(l1[[1]], ...). Your l1 is a lust and cld needs an emmGrid object. – Russ Lenth Jun 29 '21 at 01:37
  • I meant list not lust :-). The generic cld() function is in the multcomp package, so it is not wrong to include that, even though the method for emmGrid objects is in emmeans. – Russ Lenth Jun 29 '21 at 02:49
  • Thank you so much! This is exactly what I was looking for! It is working now – Shohnazar Hazratqulov Jun 29 '21 at 11:35
  • Good. But consider displaying your comparisons some other way. CLDs are misleading because they highlight what you COULDN'T prove instead of what you could. – Russ Lenth Jun 29 '21 at 21:11
  • Thank you for your advices! Which function would you recommend instead of CLD to get the best comparison? – Shohnazar Hazratqulov Jul 01 '21 at 11:47

0 Answers0