[R-SIG-Finance] Time series indexing, how can I index a series that's not a constant increase?
Gabor Grothendieck
ggrothendieck at gmail.com
Thu Jan 13 06:53:23 CET 2011
On Wed, Jan 12, 2011 at 10:49 PM, BSanders <adam at mycostech.com> wrote:
>
>
> I have missing data in my time series, but I have the appropriate date. How
> do I pass on the time index to R?
>
> For example, my days look like this
> "291 292 293 295 296 297" (I'm missing 294)
Try this:
> library(zoo)
> v <- c(291, 292, 293, 295, 296, 297)
> z <- as.zoo(as.ts(zoo(v, v)))
> z
291 292 293 294 295 296 297
291 292 293 NA 295 296 297
>
>
> time(z)
[1] 291 292 293 294 295 296 297
> coredata(z)
[1] 291 292 293 NA 295 296 297
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-SIG-Finance
mailing list