cumMax: Computes the maximum of the vector up to the current index

Description Usage Arguments Value Author(s) Examples

View source: R/cumMax.R

Description

For each index in a vector, computes the maximum of the vector from the beginning of the vector up to the current index

Usage

1
cumMax(x)

Arguments

x

A numeric or integer vector

Value

In the sequence x[1], x[2], ..., x[n], cumMax returns the vector y such that for each i = 1,...,n, y[i] = max(x[j]; j = 1,...,i)

Author(s)

Landon Sego

Examples

1
2
3
cumMax(1:10)
cumMax(c(1,3,4,5,3,2,5,1,7,8,8,6))
cumMax(c(1,3,4,5,3,2,5,1,7,8,8,6) + runif(12))

Smisc documentation built on May 30, 2017, 1:55 a.m.

Search within the Smisc package
Search all R packages, documentation and source code