revsum: revsum generates a vector of the cumulative sum from n to 1

View source: R/rutils.R

revsumR Documentation

revsum generates a vector of the cumulative sum from n to 1

Description

revsum generates a vector of the cumulative sum of an input vector from n to 1 rather than from 1 - n, as in cumsum.

Usage

revsum(x)

Arguments

x

an input vector

Value

a vector of cumulative values from n to 2

Examples

x <- c(1,2,3,4,5)/15
print(round(cbind(x,cumsum(x),revsum(x)),3))

haddonm/rutilsMH documentation built on July 21, 2023, 8:46 p.m.