How to solve this error

library(agricolae)
Aug<- DAU.test(AugC$block, AugC$trt, AugC$lt, method = c("lsd"), alpha = 0.05, group = TRUE, console=FALSE)
Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels

I suggest you check the number of levels in each factor. You can use the levels() function like this

levels(AugC$trt)

Are you sure that the variables block, try and lt of the AugC data are codified as factors? Check that doing class(AugC$block) (and same with the other two variables). If class does not return "factor" wrap the varaibles in a as.factor(AugC$block) in the call to DAU.test

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