powered by
For each index in a vector, computes the maximum of the vector from the beginning of the vector up to the current index
cumMax(x)
A numeric or integer vector
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)
cumMax
# NOT RUN { 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)) # }
Run the code above in your browser using DataLab