lag.zoo supports vector-based lags on zoo objects.
A few caveats:
- dplyr's lag clobbers the base R lag (which you need to
invoke lag's methods) so if you have dplyr loaded be sure
to refer to stats::lag.
- dplyr's lag works backwards relative to the standard set
in base R so dplyr::lag(x, 1) cor
Dear All,
I refer to the excellent post at
https://purrple.cat/blog/2018/03/02/multiple-lags-with-tidy-evaluation/
What I want to do is to create a function capable, à la dplyr, to
generate new columns which are a lagged version of existing columns in
a data frame.
For instance, you can do this
Dear All,
I refer to the excellent post at
https://purrple.cat/blog/2018/03/02/multiple-lags-with-tidy-evaluation/
What I want to do is to create a function capable, à la dplyr, to
generate new columns which are a lagged version of existing columns in
a data frame.
For instance, you can do this
3 matches
Mail list logo