Match the elements of a character vectors against a mapping table, that can specify multiple exact or partial matches.

charmap(x, maps, nomatch = NULL, partial = FALSE, rev = FALSE)

Arguments

x

character vector to match

maps

mapping tables. May be a character vector, a list of character vectors or a function.

nomatch

character string to be used for non-matched elements of x. If NULL, these elements are left unchanged.

partial

logical that indicates if partial matches are allowed, in which case mappings are used as regular expressions.

rev

logical that indicates if the mapping should be interpreted in the reverse way.