shiftData: Lead/lag/dif operations on a data.table

Description Usage Arguments Details Value Author(s)

View source: R/shift.R

Description

shiftData implements lead/lag/dif operations on a data.table and returns a resulting dataset.

Usage

1
2
shiftData(data, var, replace = FALSE, by = NULL, lag = -1, dif = FALSE,
  relative = FALSE)

Arguments

data

input dataset. Must be a data.table.

var

character vector with names of variables that should be modified

replace

replace the original variables. If FALSE (by default), the modified variables are added to the original dataset, with a suffix added to the name of the original variables.

by

character vector with name(s) of by groups.

lag

number of lags (negative) or leads (positive).

dif

take a difference? Default is FALSE.

relative

relative differences? Applicable only if dif=TRUE.

Details

.. content for ..

Value

data.table with the resulting dataset.

Author(s)

Janko Cizel


jcizel/GeneralUtilities documentation built on May 18, 2019, 10:24 p.m.