precip_cumsum {hydroToolkit} | R Documentation |
Cumulative sum of precipitation series
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
precip_cumsum(df, col_number = 2, out_name = NULL)
Arguments
df |
data frame with |
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
# 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')
[Package hydroToolkit version 0.1.0 Index]