cum_sum | R Documentation |
The function supports NA_real_
values. It could be very
useful when dealing with incomplete precipitation series.
cum_sum(x, col_name, out_name = NULL)
x |
data frame or tibble with class |
col_name |
string with column(s) name(s) where to apply the function. |
out_name |
optional. String with new column(s) name(s). If you set it
as |
The same table but with the new series.
## Not run:
# set path to file
path <- system.file('extdata', 'ianigla_cuevas.csv',
package = 'hydrotoolbox')
# read the file and add the new column with cumulative precipitation
cuevas <-
read_ianigla(path = path) %>%
cum_sum(col_name = 'Precip_Total', out_name = 'p_cum')
# plot it
plot(x = cuevas[ , 'date', drop = TRUE],
y = cuevas[ , 'p_cum', drop = TRUE],
col = 'red', type = 'l',
xlab = 'Date', ylab = 'Pcum(mm)')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.