std_cum_min_augment: Augment Cumulative Minimum

View source: R/helpers.R

std_cum_min_augmentR Documentation

Augment Cumulative Minimum

Description

This function augments a data frame by adding cumulative minimum columns for specified variables.

Usage

std_cum_min_augment(.data, .value, .names = "auto", .initial_value = 0)

Arguments

.data

A data frame to augment.

.value

A column name or names for which to compute the cumulative minimum.

.names

Optional. A character vector of names for the new cumulative minimum columns. Defaults to "auto", which generates names based on the original column names.

.initial_value

A numeric value to start the cumulative minimum from. Defaults to 0.

Details

The function takes a data frame and a column name (or names) and computes the cumulative minimum for each specified column, starting from an initial value. If the column names are not provided, it will throw an error.

Value

A tibble with the original data and additional columns containing the cumulative minimums.

Author(s)

Steven P. Sanderson II, MPH

See Also

Other Utility Functions: convert_snake_to_title_case(), generate_caption(), get_attributes(), rand_walk_helper(), running_quantile(), std_cum_max_augment(), std_cum_mean_augment(), std_cum_prod_augment(), std_cum_sum_augment()

Examples

df <- data.frame(x = c(5, 3, 8, 1, 4), y = c(10, 7, 6, 12, 5))
std_cum_min_augment(df, .value = x)
std_cum_min_augment(df, .value = y, .names = c("cummin_y"))


RandomWalker documentation built on Oct. 23, 2024, 5:07 p.m.