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 <- c(NA, 3, 4) > > y <- c(2, NA, NA) > > d <- lm(y ~ x) > Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : > 0 (non-NA) cases > > str(d) > Error in str(d) : Object "d" not found > > My question is: How do I force lm() to quietly send back an error code > like NULL? I am happy to then look at is.null(d) and handle it > accordingly. I am stuck because when things go wrong, there is no > object d to analyse! > > (My production situation is a bit more complex. It is costly for me to > first verify that the data is sound. I'd like to toss it into lm() and > get an error code for null data).
See this post from yesterday: https://www.stat.math.ethz.ch/pipermail/r-help/2005-May/070606.html ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html