Learn R Programming

dataquieR (version 2.1.0)

util_map_by_largest_prefix: 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
)

Value

character(1) with the fitting function name or NA_character_

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.

See Also

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

Examples

Run this code
if (FALSE)  # 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)
)


Run the code above in your browser using DataLab