Re: [R] lagged variables

2012-07-25 Thread Federman, Douglas
.org [mailto:r-help-boun...@r-project.org] On Behalf Of saraberta Sent: Wednesday, July 25, 2012 4:10 AM To: r-help@r-project.org Subject: [R] lagged variables hi guys, i have some trouble in creating lagged variables to use as external regressors. i'm trying to use lag(x) but it gives me as r

Re: [R] lagged variables

2012-07-25 Thread Gabor Grothendieck
On Wed, Jul 25, 2012 at 4:10 AM, saraberta wrote: > hi guys, > i have some trouble in creating lagged variables to use as external > regressors. > i'm trying to use lag(x) but it gives me as result the same time series (x), > adding this part at the end: > > attr(,"tsp") > [1]0 23231 > > w

Re: [R] lagged variables

2012-07-25 Thread Rui Barradas
Hello, You are doing nothing wrong. Follow this example. x <- ts(1:5) # Seems the same with different start and end lag(x) # But it's not cbind(x, lag(x)) Are there other functions? I know of at least one. (In the end.) These two, though not lags, might also be of interess to you. ?window y <-

[R] lagged variables

2012-07-25 Thread saraberta
hi guys, i have some trouble in creating lagged variables to use as external regressors. i'm trying to use lag(x) but it gives me as result the same time series (x), adding this part at the end: attr(,"tsp") [1]0 23231 where do i wrong?are there other functions to be used? thanks sara