I want to create a function that produces a matrix containing several lags of a variable. A simple example that works is

```
a <- ts(1:10)
cbind(a, lag(a, -1))

```

To do this for multiple lags, I have

```
lagger <- function(var, lags) {

  ### Create list of lags
  lagged <- lapply(1:lags, function(x){
    lag(var, -x)
  })

  ### Join lags together
  do.call(cbind, list(var, lagged))
}

```

Using the above example gives unexpected results;

```
lagger(a, 1)

```

gives a length 20 list with the original time series broken out into separate list slots and the final 10 each being a replication of the lagged series.

Any suggestions to getting this working? Thanks!