Skip to contents

Sort a time series

Usage

ts_sort(ts, by = c("time", "value"), order = c("ascending", "descending"))

Arguments

ts

a corehydro_ts.

by

"time" (the default) or "value".

order

"ascending" (the default) or "descending".

Value

a corehydro_ts.

Examples

ts <- time_series(as.Date("2000-01-01") + 0:4, c(3, 1, 4, 1, 5))
ts_sort(ts, by = "value")
#> <corehydro_ts> 5 ordinates, interval "one_day"
#>   2000-01-01 to 2000-01-05
#>   2000-01-02  1
#>   2000-01-04  1
#>   2000-01-01  3
#>   2000-01-03  4
#>   2000-01-05  5