[R] The opposite of "lag"

Dimitri Liakhovitski dimitri.liakhovitski at gmail.com
Wed Jul 21 19:26:57 CEST 2010


Thanks a lot, it's very helpful!

On Wed, Jul 21, 2010 at 1:21 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> 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)
>



-- 
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com



More information about the R-help mailing list