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

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 26 11:09:09 CEST 2008

Well, the na.action component (which may or may not be present in an lm 
object) is *not* what na.action is documented to give:


      The action which will be applied to 'object' whenever 'NA's are
      not desired.

So this needs some re-working, and it is not just "lm" objects that have 
the na.action information as a component and not an attribute.

On Mon, 25 Aug 2008, Andrew Redd wrote:

> 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)
> 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
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list