cumsum_bounded: cumsum bounded

View source: R/expire_status_by_inventory.R

cumsum_boundedR Documentation

cumsum bounded

Description

a version of cumsum that will stay within specified boundaries

Usage

cumsum_bounded(v, low = 0, high = Inf)

Arguments

v

a numeric vector

low

numeric; lower bound

high

numeric; upper bound

Value

a numeric vector

Examples

cumsum_bounded(c(0,-1,-100,1,7,-99,1,1,1,-1), low = -50)
cumsum_bounded(c(0,-1,-100,1,7,-99,1,1,1,-1)) ## low = 0 is default
cumsum_bounded(c(0,-1,-100,1,7,-99,1,1,1,-1), high = 5)

renlund/datma documentation built on June 2, 2025, 5:12 a.m.