schr_match_combinations: Performs matching of schr_tbl_chars() objects

Description Usage Arguments Examples

View source: R/searchr_match_combinations.R

Description

Matches any combination of letters from A against any combination of letters in B within specified tolerances. Function is case-sensitive.

Usage

1
2
3
4
5
6
schr_match_combinations(
  match_this,
  against_these,
  a_not_in_b_tolerance = 1,
  b_not_in_a_tolerance = 1
)

Arguments

match_this

tabled characters; primary input with single row of a table created by /codetable_characters()

against_these

tabled characters; various possible names to match the first argument against, characters also must be tabled through /codetable_characters()

a_not_in_b_tolerance

number of non-required characters from your /codematch_this input to find in matches, i.e. how many characters from A are not required to be in B e.g. "tori" has no characters that "tory girl" does not also have; any tolerance setting would match these; however, "tori" has one character that "tory" does not have, so matching these would require at least a tolerance of 1. Combinatorially, "tori" is a perfect match with "tior", "riot", etc, which means an /codea_not_in_b_tolerance of zero would find these matches

b_not_in_a_tolerance

number of additional-non-matching characters (like wildcards) to allow in B that are not in A, e.g. "tori" differs from "torii" by b_not_in_a_tolerance of 1, and from "victoria" by b_not_in_a_tolerance of 4. Matching those names therefore requires at least those values.

Examples

1
2
3
a_tbl <- schr_tbl_chars("eau leaf")
b_tbl <- schr_tbl_chars(c("eauleaf", "leafy", "eu leaf", "fael eau"))
schr_match_combinations(match_this = a_tbl, against_these = b_tbl)

eauleaf/searchr documentation built on Dec. 20, 2021, 3:12 a.m.