Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.64.0902260956430.17665@eowyn>
Date: 2009-02-26T08:59:22Z
From: Achim Zeileis
Subject: Importing zoo object ("index contains NAs")
In-Reply-To: <59EE907DC32.00000324bearmarketsrule@inbox.com>

On Wed, 25 Feb 2009, Rob Denniker wrote:

> Dear list,

> I have an irregular time series saved and exported as a zoo object. What 
> is the trick to force zoo to ignore the missing dates when reading it 
> back in? Thanks.

Almost certainly there are no NAs in your index (although we can't say for 
sure as Gabor pointed out).

> > write.zoo(g, file = "gdata.txt", index.name = "date", append = F, 
> quote = T, sep = ",")

> > h <- read.zoo("gdata.txt", sep = ",", format = "Y-%m-%d")
                                                    ^^^
First problem: This should be %Y.
Second problem: You need header = TRUE.

Thus, I would guess that
   h <- read.zoo("gdata.txt", sep = ",", format = "%Y-%m-%d",
     header = TRUE)
should do what you want.
Z