[R] Odp: strange error msg from lapply and lm()
petr.pikal at precheza.cz
Tue May 4 10:09:19 CEST 2010
r-help-bounces at r-project.org napsal dne 03.05.2010 16:24:11:
> I am conducting a very simple t test for two genes using lapply (i try
> avoid loop since i will have thousands of genes later on). however, I
> strange error msg like the followings. It looks that R is complaining my
> factor has only one level, which is not the case (I check many times).
In each split?
shall tell you if there are some parts of your split which has only 1 or
less non empty levels.
What is the result in your case? Shall be zero.
> > result<- lapply(split(all,all$CHIPEXP_NAME),function(x)
> > lm(logvalue~treatment,x))
> Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") :
> contrasts can be applied only to factors with 2 or more levels
> can anyone help me to dissect this problem?
> thanks in advance.
> View this message in context:
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help