subset_walks: Subset Walks by Extreme Values

View source: R/helpers.R

subset_walksR Documentation

Subset Walks by Extreme Values

Description

This function subsets random walks to identify the walk with the maximum or minimum value.

Usage

subset_walks(.data, .type = "max", .value = "y")

Arguments

.data

A data frame containing random walks. It must have columns walk_number and the specified value column.

.type

A character string specifying the type of subset: "max" for maximum value, "min" for minimum value, or "both" for both maximum and minimum values.

.value

A character string specifying the column name to use for finding extreme values. Defaults to "y".

Details

The subset_walks function takes a data frame containing random walks and subsets it to return the walk with the maximum or minimum value based on the specified type. It requires that the input data frame contains columns walk_number and the specified value column.

Value

A data frame containing the subset walk.

Author(s)

Steven P. Sanderson II, MPH

See Also

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_prod_augment(), std_cum_sum_augment()

Examples

set.seed(123)
df <- rw30()
subset_walks(df, .type = "max")
subset_walks(df, .type = "min")
subset_walks(df, .type = "both")

# Example with a specific value column
set.seed(123)
discrete_walk() |>
  subset_walks(.type = "both", .value = "cum_sum_y") |>
  visualize_walks(.pluck = 2)


RandomWalker documentation built on Aug. 19, 2025, 1:14 a.m.