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

From: Prof Brian Ripley <>
Date: Tue, 26 Aug 2008 10:09:09 +0100 (BST)

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
> ______________________________________________
> mailing list

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
Received on Tue 26 Aug 2008 - 09:10:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Aug 2008 - 16:37:42 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive