lag_dfr: lag_dfr: Lag columns of a data frame

Description Usage Arguments Examples

View source: R/lag.R

Description

lag_dfr: Lag columns of a data frame

Usage

1
lag_dfr(df, col_name, lags)

Arguments

df

The dataframe containing the time series data

col_name

The column name (single) to be used to create the lagged variables

lags

Number of lags to create for the column

Examples

1
2
3
4
5
x<-  c(2,3,5,7,9,9,5,3)
z <- c(6,9,3,3,3,4,5,7)
y <- 1:8
df <- data.frame(Y = y, X = x, Z =z)
lag_dfr(df, "X", 1:3)

josephsdavid/tswgewrapped documentation built on July 31, 2020, 9:36 a.m.