frollprod: Fast rolling product

Description Usage Arguments Value Examples

View source: R/frollprod.R

Description

Fast rolling product

Usage

1
frollprod(DT, col, N, Name = "Prod", by, ...)

Arguments

DT

The data.table to operate on

col

A quoted column name

N

An integer number that we want to shift by

Name

(optional) the name of the new column

by

(optional) A quoted by parameter

...

Some additional parameters that you can pass to the shift function

Value

The modified data.table with the new shifted columns

Examples

1
2
3
set.seed(123)
DT <- data.table(x = sample(10), y = sample(1:2, 10, replace = TRUE), key = "y")
frollprod(DT, "x", 3, by = "y", type = "lead")

DavidArenburg/dt.nuggets documentation built on May 6, 2019, 1:54 p.m.