[Rd] (PR#9134) wishlist: attribute "na.omit" added to data.frame

ripley at stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu Aug 10 07:29:09 CEST 2006


What is the "na.omit" attribute, and why is that relevant to 
model.frame.default (where na.action is an argument and only defaults to 
na.omit)?

Consider

> DF <- data.frame(x = c(1, 2, 3), y = c(0, 10, NA))
> attr(model.frame(y ~ x, DF), "na.action")
3
3
attr(,"class")
[1] "omit"

so the *na.action* attribute is set to allow users to determine what 
action is taken.  This is exactly as documented in ?na.omit.  (Further, 
lots of code (including naresid and napredict) makes use of this.)

Please explain in detail what you meant and why the documented actions do 
not suffice.


On Wed, 9 Aug 2006, hayfietj at mcmaster.ca wrote:

> Full_Name: Tristen Hayfield
> Version: 2.3.1
> OS: Windows
> Submission from: (NULL) (130.113.139.87)
> 
> 
> It would be nice if model.frame.default() (and any other model.frame()
> functions) set the "na.omit" attribute on the returned d.f, so that the caller
> could determine what action was taken.

-- 
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