Helpers
Retrieve/Replace series names
Also: series_names<-, series_names<-.radf_obj, series_names<-.wb_cv, series_names<-.sb_cv
series_names series_names(x, ...)
series_names(x) <- value
series_names(x) <- value
series_names(x) <- value
series_names(x) <- value Retrieve or replace the series names of an object.
Arguments
| x | An object. |
| ... | Further arguments passed to methods. |
| value | An ordered vector of the same length as the "index" attribute of x. |
Value
A character vector of series names. The replacement form returns the modified object.
Examples
These examples are copied from the package's own documentation and are run by R CMD check on every release.
The printed output (after #>) and the plots were produced by running them against the current package source.
rfd <- radf(sim_data)
series_names(rfd)
#> [1] "psy1" "psy2" "evans" "div" "blan"
# Rename the series, which carries through to the facet labels of tidy() and autoplot()
series_names(rfd) <- c("Bubble A", "Bubble B", "Bubble C", "Bubble D", "Bubble E")
series_names(rfd)
#> [1] "Bubble A" "Bubble B" "Bubble C" "Bubble D" "Bubble E"
tidy(rfd)
#> # A tibble: 5 × 4
#> id adf sadf gsadf
#> <fct> <dbl> <dbl> <dbl>
#> 1 Bubble A -2.46 1.95 5.19
#> 2 Bubble B -2.86 7.88 7.88
#> 3 Bubble C -5.83 5.28 5.99
#> 4 Bubble D -1.95 1.11 1.34
#> 5 Bubble E -5.15 3.93 11.0
autoplot(rfd)
#> Using precomputed critical values for `cv`. # Simulate bubble processes
dta <- data.frame(psy1 = sim_psy1(n = 100), psy2 = sim_psy2(n = 100))
rfd <- radf(dta)
series_names(rfd) <- c("OneBubble", "TwoBubbles")
exuber