frollmean: Fast rolling mean

Description Usage Arguments Value Examples

View source: R/frollmean.R

Description

Fast rolling mean

Usage

1
frollmean(DT, col, N, Name = "Mean", 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")
frollmean(DT, "x", 3, by = "y", type = "lead")

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