s-news
[Top] [All Lists]

Re: na.exclude/na.omit

To: <P.J.Wells@open.ac.uk>
Subject: Re: na.exclude/na.omit
From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
Date: Wed, 27 Jun 2001 17:10:04 +0100 (BST)
Cc: <s-news@wubios.wustl.edu>
In-reply-to: <F9D44AC0D89CD311B9E3000629385C40044D9BDD@marconi.open.ac.uk>
On Wed, 27 Jun 2001 P.J.Wells@open.ac.uk wrote:

> The following is from the Help file on these functions:
>
> "...The na.omit and na.exclude functions return the same data frame.
> However, na.exclude adds extra information on which rows were removed as the
> na.action attribute of the data frame. ..."

What version is that?  On the current S-PLUS 6.0 it says

     `na.exclude' differs from `na.omit' only in the class of the
     `"na.action"' attribute of the result, which is `"exclude"'.  This
     gives different behaviour in functions making use of `naresid' and
     `napredict': when `na.exclude' is used the residuals and
     predictions are padded to the correct length by inserting `NA's
     for cases omitted by `na.exclude'.

> I do
>
> test.exclude <- na.exclude(my.data)
> test.omit <- na.omit(my.data)
>
> and then
>
> > names(attributes(test.exclude))
> [1] "names"     "na.action" "class"     "row.names"
>
> > names(attributes(test.omit))
> [1] "names"      "na.message" "na.action"  "class"      "row.names"
>
> >From reading the Help I had expected fewer attributes from na.omit, not
> more.
>
> Am I missing something?

The above quote should help.

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


<Prev in Thread] Current Thread [Next in Thread>