[R] How to say "if error"

Paul Chatfield p.s.chatfield at reading.ac.uk
Thu Jun 24 16:17:49 CEST 2010


That's great.  That solves it.  I can work on eloquence later :)  I just  to
sort out that model problem:

 dof<-numeric(10)
for (i in 1:10){
  x<-rnorm(i-1);y<-rnorm(i-1)
  cc <- try(lm(y~x), silent=T)
  if(is(cc,"try-error")) {dof[i]<-NA}
  else {dof[i]<-(summary(lm(rnorm(10)~rgamma(10,1,1)))$coef[1,1])}
}

Thank you!

Paul
-- 
View this message in context: http://r.789695.n4.nabble.com/How-to-say-if-error-tp2266619p2267049.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list