Cumulative sum, successive differences and standardization
Source:R/timeseries.R
ts_cumulative_sum.RdThree whole-series transformations, each returning a new series.
Details
ts_cumulative_sum() treats a missing value as zero while accumulating but keeps its ordinate,
and – following the library – the result carries the DEFAULT "one_day" interval rather than
the source's. ts_difference() keeps the source's start date rather than shifting forward by
the lag. ts_standardize() subtracts the mean and divides by the standard deviation, both
computed over the observed values, and errors when the spread is zero.
Examples
ts <- time_series(as.Date("2000-01-01") + 0:5, c(3, 1, 4, 1, 5, 9))
ts_difference(ts)
#> <corehydro_ts> 5 ordinates, interval "one_day"
#> 2000-01-01 to 2000-01-05
#> 2000-01-01 -2
#> 2000-01-02 3
#> 2000-01-03 -3
#> 2000-01-04 4
#> 2000-01-05 4