[R] How to say "if error"
Paul Chatfield
p.s.chatfield at reading.ac.uk
Thu Jun 24 13:21:45 CEST 2010
- Previous message: [R] create group markers in original data frame ie.countinued... ? to calculate sth for groups defined betweenpoints in one variable (string), /separating/ spliting variable into groups by i.e. between A-B, B-C, C-D, from: A, NA, NA, B, NA, NA, C, NA, NA, NA, D
- Next message: [R] Euclidean Distance Matrix Analysis (EDMA) in R?
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
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.
- Previous message: [R] create group markers in original data frame ie.countinued... ? to calculate sth for groups defined betweenpoints in one variable (string), /separating/ spliting variable into groups by i.e. between A-B, B-C, C-D, from: A, NA, NA, B, NA, NA, C, NA, NA, NA, D
- Next message: [R] Euclidean Distance Matrix Analysis (EDMA) in R?
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the R-help
mailing list