hyet_window_sum: Calculate rolling window sum

Description Usage Arguments Value Note Examples

View source: R/hyet_window_sum.R

Description

hyet_window_sum computes the rolling sum of values. Returns an error if prec is not a numeric vector or rolling_window not a positive integer.

Usage

1
hyet_window_sum(prec, rolling_window)

Arguments

prec

a numeric vector

rolling_window

an integer that represents the rolling window as a number of time steps.

Value

a numeric vector with summed precipitation values. These values are filled with NAs at the end.

Note

Computing time depends on rolling_window. hyet_window_sum use R's base rowSums function with na.rm = TRUE.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# load data
data(prec5min)

# fill hyetograph
hyet <- hyet_fill(prec5min, 5)

# set rolling window sum to 6 records
rolling_window <- 6

# compute values
roll_sums <- hyet_window_sum(hyet$prec, rolling_window)

kvantas/erosivity documentation built on July 25, 2018, 9:32 p.m.