getRunSum: Get running sum

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/getRunSum.R

Description

Calculates a running sum with respect to a user specified window width.

Usage

1
getRunSum(x, w)

Arguments

x

numeric vector. The vector for which to calculate the running sum.

w

integer. Window width in number of time steps.

Details

The function implements a special case of filter, i.e. the case where the filter consists of 1s only, see 'Examples' below.

Value

Numeric vector of the same length as x.

Author(s)

Simon S.

See Also

filter

Examples

1
2
3
4
x <- rnorm(20)
w <- 4
getRunSum(x=x,w=w)
filter(x=x,filter=rep(1,times=w),sides=1)

hydro-giub/hydroBE documentation built on Sept. 20, 2019, 9:27 a.m.