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

Marc Schwartz marc_schwartz at me.com
Mon Sep 19 23:33:46 CEST 2011


On Sep 19, 2011, at 4:00 PM, Rich Shepard wrote:

> On Mon, 19 Sep 2011, Marc Schwartz wrote:
> 
>>> Is there a way to omit only those rows where all columns contain 'NA'?
> 
>> You can look at ?complete.cases for one approach, presuming that it will
>> work on zoo objects.
> 
> Marc,
> 
>  Do I even need to worry about these NAs? Thanks to Gabor I have a data
> frame with 296 stream/parameter sets. Each set begins and ends on a
> different date (used as the zoo index).
> 
>  What I want to do initially is plot the time series for each
> stream/parameter to see what each has to tell us. In this case, if there are
> years of NAs prior to the fist measurement for that stream/parameter pair,
> will this affect anything.
> 
>  On a related note, I'm reading the zoo help pages and vignettes but do not
> see the syntax for specifying which stream/parameter pair I want to plot.
> What do I read to learn how to do this?
> 
> Rich


Hi Rich,

Let me start by acknowledging that I have little practical experience in time series analyses, much less proficiency with the zoo package. I just don't come across them much in clinical trials/studies, at least the ones that I have been involved with over the past 25+ years.

I do know from prior posts on the matter, that the zoo package seems to have some of its own approaches to dealing with dates, as compared to base R. So you may need to be clear on the differentiation in code/functions required to use some of the package functionality.

So from a analytic perspective, I would encourage others to chime in with guidance. Missing data generally has an impact at some level, the extent of which is going to be specific to the context of the particular analysis being performed and any assumptions one may be willing to make.

There is also the r-sig-finance list:

  https://stat.ethz.ch/mailman/listinfo/r-sig-finance

to which this query may be better suited in terms of gaining a focused audience in a domain where time series analyses are prevalent. 

There are also some books on using R for time series analyses, some of which are listed on the "Books" link from the R homepage. It would seem logical that one or more of them might cover the use of the zoo package, but that is a guess on my part.

I hope that the above is helpful Rich.

I also presume that you got my "final" version of the two functions, with the corrected data frame based approach. Sorry for the confusion on that earlier.

Regards,

Marc



More information about the R-help mailing list