| rand_walk_helper | R Documentation |
A function to help build random walks by mutating a data frame.
rand_walk_helper(.data, .value)
.data |
The data frame to mutate. |
.value |
The .initial_value to use. This is passed from the random walk function being called by the end user. |
A function to help build random walks by mutating a data frame. This mutation
adds the following columns to the data frame: cum_sum, cum_prod, cum_min,
cum_max, and cum_mean. The function is used internally by certain functions
that generate random walks.
A modified data frame/tibble with the following columns added:
cum_sum: Cumulative sum of y.
cum_prod: Cumulative product of y.
cum_min: Cumulative minimum of y.
cum_max: Cumulative maximum of y.
cum_mean: Cumulative mean of y.
Steven P. Sanderson II, MPH
Other Utility Functions:
confidence_interval(),
convert_snake_to_title_case(),
generate_caption(),
get_attributes(),
rand_walk_column_names(),
running_quantile(),
std_cum_max_augment(),
std_cum_mean_augment(),
std_cum_min_augment(),
std_cum_prod_augment(),
std_cum_sum_augment(),
subset_walks()
df <- data.frame(
walk_number = factor(rep(1L:25L, each = 30L)),
x = rep(1L:30L, 25L),
y = rnorm(750L, 0L, 1L)
)
rand_walk_helper(df, 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.