[R] zoo objects and "c"
Erin Hodgess
erinm.hodgess at gmail.com
Mon Jul 26 20:24:55 CEST 2010
Whoops...sorry about that. Here we go:
> dput(xgh)
structure(c(5, 6, 1, 5, 0, 0, 13, 9, 6, 4, 6, 0, 0, 9, 15, 10,
5, 6, 0, 0, 0, 12, 8, 3, 6, 0), index = structure(c(14775, 14776,
14777, 14778, 14779, 14780, 14781, 14782, 14783, 14784, 14785,
14786, 14787, 14788, 14789, 14790, 14791, 14792, 14793, 14794,
14795, 14796, 14797, 14798, 14799, 14800), class = "Date"), class = "zoo")
> dput(xs)
structure(c(14775, 14776, 14777, 14778, 14779, 14780, 14781,
14782, 14783, 14784, 14785, 14786, 14787, 14788, 14789, 14790,
14791, 14792, 14793, 14794, 14795, 14796, 14797, 14798, 14799,
14800, 14801, 14802, 14803, 14804, 14805), class = "Date")
> zoo(c(xgh,-0.7,3.6,3.7,3.4,3.2),order=xs)
Error in rbind.zoo(...) : indexes overlap
>
I just tried this:
zoo(c(as.numeric(xgh),-0.7,3.6,3.7,3.4,3.2),order=xs)
and it does work. However, I'm not sure if that's the right way to go.
Thanks,
Erin
On Mon, Jul 26, 2010 at 1:20 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> On Mon, Jul 26, 2010 at 2:17 PM, Erin Hodgess <erinm.hodgess at gmail.com> wrote:
>> Dear R People:
>>
>> I would like to combine a zoo object with some observations at the end.
>>
>> Here is the set up:
>>
>>> xgh
>> 2010-06-15 2010-06-16 2010-06-17 2010-06-18 2010-06-19 2010-06-20 2010-06-21
>> 5 6 1 5 0 0 13
>> 2010-06-22 2010-06-23 2010-06-24 2010-06-25 2010-06-26 2010-06-27 2010-06-28
>> 9 6 4 6 0 0 9
>> 2010-06-29 2010-06-30 2010-07-01 2010-07-02 2010-07-03 2010-07-04 2010-07-05
>> 15 10 5 6 0 0 0
>> 2010-07-06 2010-07-07 2010-07-08 2010-07-09 2010-07-10
>> 12 8 3 6 0
>>> xs
>> [1] "2010-06-15" "2010-06-16" "2010-06-17" "2010-06-18" "2010-06-19"
>> [6] "2010-06-20" "2010-06-21" "2010-06-22" "2010-06-23" "2010-06-24"
>> [11] "2010-06-25" "2010-06-26" "2010-06-27" "2010-06-28" "2010-06-29"
>> [16] "2010-06-30" "2010-07-01" "2010-07-02" "2010-07-03" "2010-07-04"
>> [21] "2010-07-05" "2010-07-06" "2010-07-07" "2010-07-08" "2010-07-09"
>> [26] "2010-07-10" "2010-07-11" "2010-07-12" "2010-07-13" "2010-07-14"
>> [31] "2010-07-15"
>>> zoo(c(xgh,-0.7,3.6,3.7,3.4,3.2),order=xs)
>> Error in rbind.zoo(...) : indexes overlap
>>>
>>
>> What am I doing wrong, please? I'm sure that it's something simple.
>>
>
> please use dput when posting to r-help:
>
> dput(xgh)
>
--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com
More information about the R-help
mailing list