| index_series | R Documentation |
Rescale numeric series relative to their earliest observed value or to the arithmetic mean over a selected base period.
index_series(
data,
date_col = "date",
value_col = "value",
group_cols = NULL,
base_period = NULL,
base_value = 100,
na_rm = FALSE,
suffix = NULL,
.quiet = FALSE
)
data |
A non-empty |
date_col |
Name of the |
value_col |
Non-empty character vector naming numeric value columns. |
group_cols |
Optional character vector naming grouping columns. Each group receives its own reference value. |
base_period |
|
base_value |
Finite positive number assigned to the reference. Defaults to 100. |
na_rm |
Whether to remove missing values when averaging an explicit
base period. With the default |
suffix |
Optional non-missing character suffix for generated names. |
.quiet |
If |
When base_period is supplied, dates are matched at the detected calendar
frequency of each group. Thus, for monthly data, as.Date("2019-01-01") also matches an
observation dated at month end. Weekly and daily series use exact interval
containment. A partly observed base interval produces a warning.
With base_period = NULL, a warning identifies any series whose first dated
value is missing and whose reference moves to a later date.
A tibble containing the original columns, in their original order,
followed by index_{value_col} columns (and _{suffix} when supplied).
augment_trends() for trend estimation and augment_rolling() for
rolling and year-to-date aggregations.
vehicles |>
index_series(value_col = "production")
retail_volume |>
index_series(group_cols = "name_series", base_period = 2019)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.