For an answer to your question 2. look at help(try)
and help(tryCatch).

--- Yong Wang <[EMAIL PROTECTED]> wrote:

> Dear Rlist
> 
> I am runing a for loop on a large dataset to do
> exploring
> investigation. Code embedded in the loop include the
> "lm" routine.
> Unfortunately, for some specification of dependent
> variable, the loop
> will be interrupted by error as below:
> 
> Error in `contrasts<-`(`*tmp*`, value =
> "contr.treatment") :
>         contrasts can be applied only to factors
> with 2 or more levels
> 
> I suspect this might be caused by missing value
> which, once removed,
> will left some factors has value only on one level.
> It turnss out this
> is not true.
> 
> Answers for following two questions appreciated.
> 1. what might be the possible reason behind the
> error mesage
> 2. if I simply want to circumvent this error and
> keep the for loop
> going, how should I do that.
> 
> 
> Regards
> young
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to