[R] Problem with merging two zoo objects

Megh Dal megh700004 at yahoo.com
Sat Oct 16 03:50:37 CEST 2010


I dont know whether I am missing something or not:

> head(read.zoo(file="f:/dat1.txt", header=T, sep=",", format = "%m/%d/%Y %H:%M:%S"), tz="GMT")
           data.open data.high data.low data.close
2010-10-15      73.7      73.7     73.7       73.7
2010-10-15      73.8      73.8     73.8       73.8
2010-10-15      73.8      73.8     73.8       73.8
2010-10-15      73.8      73.8     73.8       73.8
2010-10-15      73.8      73.8     73.8       73.8
2010-10-15      73.8      73.8     73.8       73.8
Warning messages:
1: In zoo(rval3, ix) :
  some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique
2: In zoo(rval, x.index[i]) :
  some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique
> head(read.zoo(file="f:/dat1.txt", header=T, sep=",", format = "%m/%d/%Y %H:%M:%S"))
           data.open data.high data.low data.close
2010-10-15      73.7      73.7     73.7       73.7
2010-10-15      73.8      73.8     73.8       73.8
2010-10-15      73.8      73.8     73.8       73.8
2010-10-15      73.8      73.8     73.8       73.8
2010-10-15      73.8      73.8     73.8       73.8
2010-10-15      73.8      73.8     73.8       73.8
Warning messages:
1: In zoo(rval3, ix) :
  some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique
2: In zoo(rval, x.index[i]) :
  some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique

In either case, I am missing the "time" component. Where I am going wrong?

Thanks,


--- On Sat, 10/16/10, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:

> From: Gabor Grothendieck <ggrothendieck at gmail.com>
> Subject: Re: [R] Problem with merging two zoo objects
> To: "Megh" <megh700004 at yahoo.com>
> Cc: r-help at r-project.org
> Date: Saturday, October 16, 2010, 2:33 AM
> On Fri, Oct 15, 2010 at 4:27 PM, Megh
> <megh700004 at yahoo.com>
> wrote:
> >
> > Thanks Gabor for pointing to my old version. However I
> got one more question
> > why the argument tz="" is sitting there? As you are
> not passing any explicit
> 
> It would otherwise assume "Date" class.
> 
> > str(read.zoo(file="dal1.csv", header=TRUE, sep=",",
> format = "%m/%d/%Y %H:%M:%S", aggregate = mean))
> ‘zoo’ series from 2010-10-15 to 2010-10-15
>   Data: num [1, 1:4] 73.7 73.7 73.7 73.7
>  - attr(*, "dimnames")=List of 2
>   ..$ : chr "2010-10-15"
>   ..$ : chr [1:4] "data.open" "data.high" "data.low"
> "data.close"
>   Index: Class 'Date'  num 14897 
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> 
> 
> -- 
> 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