| std_cum_prod_augment | R Documentation |
This function augments a data frame by adding cumulative product columns for specified variables.
std_cum_prod_augment(.data, .value, .names = "auto", .initial_value = 1)
.data |
A data frame to augment. |
.value |
A column name or names for which to compute the cumulative product. |
.names |
Optional. A character vector of names for the new cumulative product columns. Defaults to "auto", which generates names based on the original column names. |
.initial_value |
A numeric value to start the cumulative product from. Defaults to 1. |
The function takes a data frame and a column name (or names) and computes the cumulative product for each specified column, starting from an initial value. If the column names are not provided, it will throw an error.
A tibble with the original data and additional columns containing the cumulative products.
Steven P. Sanderson II, MPH
Other Utility Functions:
confidence_interval(),
convert_snake_to_title_case(),
generate_caption(),
get_attributes(),
rand_walk_column_names(),
rand_walk_helper(),
running_quantile(),
std_cum_max_augment(),
std_cum_mean_augment(),
std_cum_min_augment(),
std_cum_sum_augment(),
subset_walks()
df <- data.frame(x = 1:5, y = 6:10)
std_cum_prod_augment(df, .value = x)
std_cum_prod_augment(df, .value = y, .names = c("cumprod_y"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.