[R] read.zoo issues

Santosh Srinivas santosh.srinivas at gmail.com
Mon Oct 18 14:37:25 CEST 2010


Okay ... now I gotcha ... Thanks

-----Original Message-----
From: Gabor Grothendieck [mailto:ggrothendieck at gmail.com] 
Sent: 18 October 2010 17:19
To: Santosh Srinivas
Cc: r-help at r-project.org
Subject: Re: [R] read.zoo issues

On Mon, Oct 18, 2010 at 4:24 AM, Santosh Srinivas
<santosh.srinivas at gmail.com> wrote:
> I am getting problems using read.zoo
>
> I have the following data frame
>
>> head(anlyNiftyDat[,1:10])
>            TIMESTAMP    ACC AMBUJACEM AXISBANK BAJAJ-AUTO BHARTIARTL
> BHEL   BPCL  CAIRN  CIPLA
> 1 2010-01-04 00:00:00 913.60    106.10   992.10    1732.05     325.20
> 2426.10 650.75 285.50 337.55
> 2 2010-01-05 00:00:00 901.75    105.30  1012.80    1740.05     330.35
> 2435.40 640.95 295.85 331.50
> 3 2010-01-06 00:00:00 907.60    105.95   995.80    1713.15     326.85
> 2426.25 631.30 299.45 344.90
> 4 2010-01-07 00:00:00 913.35    105.80  1002.85    1683.10     329.40
> 2409.50 619.05 307.85 342.05
> 5 2010-01-08 00:00:00 912.15    105.90  1015.95    1655.25     325.05
> 2424.10 629.55 306.15 341.10
> 6 2010-01-11 00:00:00 915.15    106.10  1049.40    1669.55     328.95
> 2396.95 627.90 300.15 342.30
>
>> class(anlyNiftyDat)
> [1] "cast_df"    "data.frame"
>>
>
>> anlyNiftyDatZoo <- read.zoo(anlyNiftyDat,split=2,check.names=F)
>> head(anlyNiftyDatZoo[,1:10])
>           X805.45.1 X805.45.2 X805.45.3 X805.45.4 X805.45.5 X805.45.6
> X805.45.7 X805.45.8 X805.45.9 X805.45.10
> 2010-01-04        NA        NA        NA        NA        NA        NA
> NA        NA        NA         NA
> 2010-01-05        NA        NA        NA        NA        NA        NA
> NA        NA        NA         NA
> 2010-01-06        NA        NA        NA        NA        NA        NA
> NA        NA        NA         NA
> 2010-01-07        NA        NA        NA        NA        NA        NA
> NA        NA        NA         NA
> 2010-01-08        NA        NA        NA        NA        NA        NA
> NA        NA        NA         NA
> 2010-01-11        NA        NA        NA        NA        NA        NA
> NA        NA        NA         NA
>
> Both the column names and values are thrown off.


There is no reason to think that read.zoo should be able to understand
cast_df objects from the reshape package.   Use  the reshape2 package
instead which produces ordinary data frames rather than cast_df
objects.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list