Skip to contents

This function generates base scale names from a list of scales, keeping only the first few parts of each scale name as specified by the user. The scales are separated into parts by an underscore (_). Scales with fewer parts than a specified minimum are filtered out.

Usage

get_scale_names(scale_list, min_parts = 3, parts_to_keep = 2)

Arguments

scale_list

A character vector with the names of the scales to be processed.

min_parts

The minimum number of parts a scale must have to be included. Default is 3.

parts_to_keep

The number of parts to keep for the base scale name. Default is 2.

Value

A character vector with the base scale names.

Details

For each scale in the scale list, the function splits the scale name into parts based on the underscore (_). It keeps the first few parts as specified by the user and combines them back into a base scale name. The base scale names are then returned as a unique list.

References

(Optional)

Examples

# Assuming scales is your list of scales
base_scales <- get_scale_names(scales, min_parts = 3, parts_to_keep = 2)
#> Error in eval(expr, envir, enclos): object 'scales' not found