[R] strange error msg from lapply and lm()

weix1 weix1_2007 at hotmail.com
Mon May 3 16:24:11 CEST 2010


I am conducting a very simple t test for two genes using lapply (i try to
avoid loop since i will have thousands of genes later on). however, I got
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).

> 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: http://r.789695.n4.nabble.com/strange-error-msg-from-lapply-and-lm-tp2124042p2124042.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list