runmax function

Running maximum

Running maximum

Running nn-value maximum and data frame with variable swapped for running maximum

runmax(y, n) dfrunmax(data, cons, ynm, n = 2)

Arguments

  • y: a vector
  • n: an integer giving the number of observations to calculate running maxmimum over; defaults to 2
  • data: a data frame
  • cons: a character string for the variable in data that identifies consecutive observations
  • ynm: a character string for the variable in data that is the observations

Returns

runmax returns a vector of the same dimension as y

dfrunmax returns a data frame with observations swapped for nn-observation running maximum

Examples

runmax(runif(10), 5)
  • Maintainer: Ben Youngman
  • License: GPL-3
  • Last published: 2022-06-28

Useful links

    Downloads (last 30 days):