Thanks Roman - you're right it can do more than I thought. We're close now to solving it I feel. Essentially I'm trying to get the code below to work. If the condition is satisfied, it prints 2, but it doesn't save it in z. I want it to save it even though there's an error. Perhaps you can easily see what I'm missing,
x<-rnorm(0);y<-rnorm(0) z<-ifelse(tryCatch(lm(y~x), finally=print(2))==1, NA,lm(rnorm(10)~rnorm(10))) -- View this message in context: http://r.789695.n4.nabble.com/How-to-say-if-error-tp2266619p2266782.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.