Hello, everyone!
Assume you have this data:
data - structure(c(66.609375, 67.09375, 66.40625, 66.734375, 67.109375,
66.875, 66.09375, 65.921875, 66.546875, 66.140625, 66.140625,
65.65625, 65.875, 65.59375, 65.515625, 66.09375, 66.015625, 66.140625,
66.109375, 66.421875, 1702.7, 1647.7, 1649.4,
See ?diff.zoo
dif - diff(data, arithmetic = FALSE) - 1
cbind(data, dif)
On Wed, Feb 11, 2009 at 6:21 AM, Sergey Goriatchev serg...@gmail.com wrote:
Hello, everyone!
Assume you have this data:
data - structure(c(66.609375, 67.09375, 66.40625, 66.734375, 67.109375,
66.875, 66.09375,
Sergey Goriatchev wrote:
Hello, everyone!
Assume you have this data:
data - structure(c(66.609375, 67.09375, 66.40625, 66.734375, 67.109375,
66.875, 66.09375, 65.921875, 66.546875, 66.140625, 66.140625,
65.65625, 65.875, 65.59375, 65.515625, 66.09375, 66.015625, 66.140625,
66.109375,
Dear Gabor,
Thank you as always. I will follow your suggestion.
But, I still want to know what I do wrong in the above code (with
embed(), apply(), and merge() functions). Why do I get that error
message and how can I rewrite the code to make it run.
Best Regards,
Sergey
On Wed, Feb 11, 2009 at
Dear Peter,
I tried with the comma already, it did not work.
rets
TY1.lev SP1.lev GC1.lev CL1.lev
2000-01-03 66.60938 1702.7 453.7 18.34
2000-01-04 67.09375 1647.7 447.8 18.29
2000-01-05 66.40625 1649.4 446.2 17.65
2000-01-06 66.73438 1639.9 446.5 17.52
2000-01-07
Sergey Goriatchev wrote:
Dear Peter,
I tried with the comma already, it did not work.
Ah, yes, sorry. The real issue is that you are trying to index twice,
both by apply(.,2,.) and by z=TY1.lev (the former loops over columns
and the latter selects one of them). So what func() sees is an
There is no zoo method for embed. embed is implicit in
rollapplly so its not normally needed in zoo and rollapply,
lag or diff would normally be used instead.
If you did want to use embed then unzoo data first but
that will lose the time index so add it back in later:
e -
Understood.
Peter, Gabor, thank you for your time and help.
Regards,
Sergey
On Wed, Feb 11, 2009 at 14:24, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
There is no zoo method for embed. embed is implicit in
rollapplly so its not normally needed in zoo and rollapply,
lag or diff would
8 matches
Mail list logo