[R] Error Handling

From: Sit Yee Kong <sityeekong_at_hotmail.com>
Date: Tue, 24 Jun 2008 17:59:24 +0000

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. Received on Tue 24 Jun 2008 - 18:04:30 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 - 20:31:37 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