Learn R Programming

RandomWalker (version 1.1.0)

subset_walks: 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")

Value

A data frame containing the subset walk.

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".

Author

Steven P. Sanderson II, MPH

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.

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

Run this code
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)

Run the code above in your browser using DataLab