R/helper_functions.R

Defines functions rolling_window to_scalar

to_scalar <- function(x) {
  trunc(as.numeric(x[1]))
}

rolling_window <- function(n, window) {
  steps <- seq_len(n - window + 1)
  Map(seq, from = steps, length.out = window)
}
marberts/gpindexExtra documentation built on Dec. 21, 2021, 1:49 p.m.