[Rd] na.action does not return na.action element of lm object

Andrew Redd amredd at gmail.com
Mon Aug 25 22:07:59 CEST 2008


I'm not sure if this is the official behavior but I would expect the
na.action function applied to a lm object to return the na.action.
Here is what I mean.

> x<-0:10
> y<-x+rnorm(10)
Warning message:
In x + rnorm(10) :
  longer object length is not a multiple of shorter object length
> y[5]<-NA
> m<-lm(y~x)
> m$na.action
5
5
attr(,"class")
[1] "omit"
> na.action(m)
NULL

I would expect na.action(m) to return m$na.action.  This is simple
enough to fix with
na.action.lm<-function(object,...)object$na.action
but I would expect that this would already be included in the base.
Is there a reason that it is not?  I did a search through the archives
but did not turn up anything relevant.

Thanks,
Andrew Redd



More information about the R-devel mailing list