Re: [R] Error Handling

From: jim holtman <jholtman_at_gmail.com>
Date: Tue, 24 Jun 2008 15:15:43 -0400

?try

On Tue, Jun 24, 2008 at 1:59 PM, Sit Yee Kong <sityeekong_at_hotmail.com> wrote:
>
> Hi All,
>
> The for-loop below stopped when error("Cannot get confidence intervals on var-cov components: Non-positive definite approximate variance-covariance") occurred.
> I assigned a row of NA values
> to the data frame "m1" manually and reset "j" in the for-loop every time error returned. I'm wondering if
> there is a function that can detect error or failure, so the for-loop WILL NOT stop and the NA values can be assigned automatically if specified condition met. This can solve my problem that I need to set the NA values manually and reset j in for-loop every time error returned. Doing this manually would be very tedious.
> m1<-matrix(ncol=3,nrow=0)
> for (j in 1:1000){
>
> fit<-lme(Expression~1,random=~1|MonkeyID, data=mydata1,subset=Probes==as.character(Probes_Blood_sub[j,"probe"]))
> ci<-intervals(fit)$reStruct$MonkeyID^2
> m1<-rbind(m1,ci)}
> Thanks,Sityee
>
> _________________________________________________________________
> The i'm Talkathon starts 6/24/08. For now, give amongst yourselves.
>
> [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help_at_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.
>
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help_at_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.
Received on Tue 24 Jun 2008 - 19:23:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 24 Jun 2008 - 19:30:54 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive