Re: [R] Catching an error with lm()

2005-05-24 Thread Gabor Grothendieck
On 5/24/05, Ajay Narottam Shah <[EMAIL PROTECTED]> wrote: > Folks, > > I'm in a situation where I do a few thousand regressions, and some of > them are bad data. How do I get back an error value (return code such > as NULL) from lm(), instead of an error _message_? > > Here's an example: > > > x

[R] Catching an error with lm()

2005-05-24 Thread Ajay Narottam Shah
Folks, I'm in a situation where I do a few thousand regressions, and some of them are bad data. How do I get back an error value (return code such as NULL) from lm(), instead of an error _message_? Here's an example: > x <- c(NA, 3, 4) > y <- c(2, NA, NA) > d <- lm(y ~ x) Error in lm.fit(x, y, o