Consider the following: > lm(conc ~ Type, CO2, subset = Plant == "Quebec") Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") : contrasts can be applied only to factors with 2 or more levels
Here Type is a factor for which only one level occurs within the "Quebec" subset. This is something that one would think would be possible to handle in lm. (Note that singular.ok = TRUE is the default.) I came across this when automatically performing lm's on the levels of a conditioning variable, such as Plant in the above example, and found I had to unexpectedly special case situations like the above. lmList() in lme4 is likely adversely affected by this as well. ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel