precip_cumsum: Cumulative sum of precipitation series

Description Usage Arguments Value Examples

View source: R/precip_cumsum.R

Description

Returns a data frame with two columns: the date and the cumulative sum of the chosen col_number. This function can deal with NA_real_.

Usage

1
precip_cumsum(df, col_number = 2, out_name = NULL)

Arguments

df

data frame with Date (or POSIXct) in the first column and numeric variables on the others.

col_number

numeric. The column number of the series where to apply the cumulative sum.

out_name

optional. String value with the column output name. Default is 'cumsum_' plus the original name.

Value

A data frame with two columns: date and the cumulative sum of the series.

Examples

1
2
3
4
5
6
7
8
# Load daily precipitation data-set from BDHI
load( paste0(system.file('extdata', package = "hydroToolkit"), '/bdhi_p.rda') )

# Get compact slot
p_bdhi <- get_hydroMet(obj = bdhi_p, name = 'compact')[[1]]

# Apply cumulative precipitation function
p_cum <- precip_cumsum(df = p_bdhi, col_number = 2, out_name = 'cum_guido')

hydroToolkit documentation built on July 2, 2020, 1:04 a.m.