[R] Results of applying na.omit on zoo object

Marc Schwartz marc_schwartz at me.com
Mon Sep 19 18:53:56 CEST 2011


On Sep 19, 2011, at 11:48 AM, Rich Shepard wrote:

>  I read in ?na.omit that it returns the object with incomplete cases
> removed. I interpret this to mean that any zoo object row where any column
> shows 'NA' will be removed from the data set.
> 
>  That's not what I need, since the 'NA' represents information in my
> context. However, what I would like to do is eliminate the rows where every
> column is 'NA'. When I aggregate two factors by date in the zoo object, the
> rows being with the earliest possible date even if that's not appropriate
> for the row factor pair.
> 
>  Is there a way to omit only those rows where all columns contain 'NA'?
> 
> Rich



You can look at ?complete.cases for one approach, presuming that it will work on zoo objects.

HTH

Marc Schwartz



More information about the R-help mailing list