rel_start | R Documentation |
Convenience wrapper of dplyr::group_by
and dplyr::mutate
to
scale variables, especially time-series, by series start values
rel_start(df, col_vars, group_vars)
df |
data.frame |
col_vars |
variable names (quoted or unquoted) to rescale to initial values |
group_vars |
variable names (quoted or unquoted) to group |
data.frame with all original data and new rel_
columns for each
rescaled variable
test_df <- data.frame(grp = rep(1:3, each = 10)
, val = rep(10:1, times = 3))
test_df %>%
rel_start(col_vars = val, group_vars = grp) %>%
print(n = 30)
test_df %>%
rel_start(col_vars = "val", group_vars = "grp") %>%
print(n = 30)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.