[R] The opposite of "lag"
Gabor Grothendieck
ggrothendieck at gmail.com
Wed Jul 21 19:21:57 CEST 2010
On Wed, Jul 21, 2010 at 1:16 PM, Dimitri Liakhovitski
<dimitri.liakhovitski at gmail.com> wrote:
> I reinstalled zoo and now I can see the years on left (raw names).
> Before - I could not see them.
> Thank you!
Note that the result is a zoo object. A zoo object consists of data
(which is everything except
the years, here) and the time index which is shown along the left hand side.
If lg is the zoo object then coredata(lg) and index(lg) give the two
components while
as.data.frame(lg) does give a data frame with the years as rownames.
lg <- lag(z, c(-1, 0, 1))
coredata(lg)
index(lg)
as.data.frame(lg)
More information about the R-help
mailing list