util_map_by_largest_prefix: Map based on largest common prefix

View source: R/util_map_by_largest_prefix.R

util_map_by_largest_prefixR Documentation

Map based on largest common prefix

Description

Map based on largest common prefix

Usage

util_map_by_largest_prefix(
  needle,
  haystack,
  split_char = "_",
  remove_var_suffix = TRUE
)

Arguments

needle

character(1) item to search

haystack

character items to find the entry sharing the largest prefix with needle

split_char

character(1) to split entries to atomic words (like letters, if "" or snake_elements, if "_")

remove_var_suffix

logical(1) remove potential suffix after the first dot ., before finding needle in haystack.

Value

character(1) with the fitting function name or NA_character_

See Also

Other mapping: util_map_all(), util_map_labels(), util_recode()

Examples

## Not run:  # internal function
util_map_by_largest_prefix(
  "acc_distributions_loc_ecdf_observer_time",
  names(dataquieR:::.manual$titles)
)
util_map_by_largest_prefix(
  "acc_distributions_loc_observer_time",
  names(dataquieR:::.manual$titles)
)
util_map_by_largest_prefix(
  "acc_distributions_loc_ecdf",
  names(dataquieR:::.manual$titles)
)
util_map_by_largest_prefix(
  "acc_distributions_loc",
  names(dataquieR:::.manual$titles)
)

## End(Not run)


dataquieR documentation built on May 29, 2024, 7:18 a.m.