[R] Omitting NAs in aggregate.ts()

From: Waichler, Scott R <Scott.Waichler_at_pnl.gov>
Date: Tue 17 May 2005 - 08:19:27 EST

I have a time series vector (not necessarily ts class) that has NAs in it.
How can I omit the NAs when using aggregate.ts() to compute a function on each window? If there is at least one non-NA value in each window, I'd like to proceed with evaluating the function; otherwise, I would like NA returned. I'm not wedded to aggregate.ts and don't need ts class if there is another fast, vectorized way to handle this. Here is what I am trying to do, with the invalid na.rm thrown in:

as.vector(aggregate.ts(x, ndeltat=24, FUN=min, na.rm=F))

Scott Waichler
Pacific Northwest National Laboratory

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue May 17 08:28:00 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:46 EST