Skip to content
Back to formatted view

Raw Message

Message-ID: <AANLkTikFnDPCksi7_tDZih5shLWwPUkKJbf2cGEVbFLu@mail.gmail.com>
Date: 2011-01-13T05:53:23Z
From: Gabor Grothendieck
Subject: Time series indexing, how can I index a series that's not a constant increase?
In-Reply-To: <1294890551697-3215199.post@n4.nabble.com>

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