control_matches() returns a data frame showing which type of match was used
for each value in x. This is useful for debugging or inspecting how
control() recodes values.
Usage
control_matches(
x,
thesaurus,
thesaurus_cols = c(1, 2),
case_insensitive = FALSE,
fuzzy_boundary = FALSE,
fuzzy_encoding = FALSE
)Arguments
- x
Vector to recode.
- thesaurus
Data frame with a vector of preferred terms and a vector of variants.
- thesaurus_cols
Vector of two column names or positions specifying which columns in
thesauruscontain the preferred terms and variants respectively. Defaults to the first two columns.- case_insensitive
Set to
TRUEto perform case insensitive matching.- fuzzy_boundary
Set to
TRUEto perform fuzzy matching that ignores differences in the word boundaries used (e.g."foo bar"matches"foo-bar").- fuzzy_encoding
Set to
TRUEto perform fuzzy matching that ignores non-ASCII characters that may have been encoded differently (e.g."foo"matches"foö").