lag_best_n: Lagged Best N Values

Description Usage Arguments

View source: R/lag_best_n.R

Description

Calculates a function (.f) of the top best_n values from x over the previous window days. Assumes that x and index are already in order according to index.

Usage

1
2
lag_best_n(x, index, best_n = 5, window = 365, .f = mean, adj = c(1.4,
  1.3, 1.2, 1.1))

Arguments

x

numeric vector of values

index

dates, assumed to be character in YYYY-MM-DD format

best_n

integer

window

integer; previous number of days to examine

adj

vector of adjustments for when there are fewer than best_n values.


joranE/statskier2 documentation built on May 19, 2019, 8:42 p.m.