[R] Problem with merging two zoo objects

Megh Dal megh700004 at yahoo.com
Sat Oct 16 03:56:36 CEST 2010


However I have noticed a strange thing. Placing of "tz = """ matters here:

> head(read.zoo("f:/dat1.txt", sep = ",", header = TRUE, format =  "%m/%d/%Y %H:%M:%S"), tz = "")
           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("f:/dat1.txt", sep = ",", header = TRUE, tz = "", format =  "%m/%d/%Y %H:%M:%S"))
                    data.open data.high data.low data.close
2010-10-15 09:00:24     74.35     74.35    74.35      74.35
2010-10-15 09:01:15     74.30     74.30    74.30      74.30
2010-10-15 09:01:21     74.35     74.35    74.35      74.35
2010-10-15 09:01:27     74.20     74.20    74.20      74.20
2010-10-15 09:01:30     74.25     74.25    74.25      74.25
2010-10-15 09:01:36     74.25     74.25    74.25      74.25
Warning message:
In zoo(rval3, ix) :
  some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique

Is it a bug or a rule that for any function, placing of it's arguments matter?

Thanks,

--- On Sat, 10/16/10, Megh Dal <megh700004 at yahoo.com> wrote:

> From: Megh Dal <megh700004 at yahoo.com>
> Subject: Re: [R] Problem with merging two zoo objects
> To: "Gabor Grothendieck" <ggrothendieck at gmail.com>
> Cc: r-help at r-project.org
> Date: Saturday, October 16, 2010, 7:20 AM
> 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