potential_match: Find potential matches for a vector against another

View source: R/potential_match.R

potential_matchR Documentation

Find potential matches for a vector against another

Description

Given a vector, find potential matches for each item against another vector. Items can also be grouped to check only against items in the same grouping.

Usage

potential_match(vec1, group1=NULL, vec2, group2=NULL, fancy=FALSE, agrep_value=.3, adist_value=1)

Arguments

vec1

character vector.

group1

character vector, of the same length as vec1.

vec2

character vector.

group2

character vector, of the same length as vec2.

fancy

if TRUE, use agrep to determine approximate matches. If FALSE, use adist to determine approximate matches.

agrep_value

max.distance argument to agrep. Used when fancy==FALSE. See agrep.

adist_value

Maximum Levenshtein distance between strings allowed for results. Higher values allows for less similar strings to be returned as potential matches. Used when fancy==TRUE. See adist.

Value

A data.table. The first two columns are the group (if applicable) and original character strings matched from vec1. Columns three through eight contain up to six potential matches for the group/string pair in columns one and two. Where fewer than six potential matches are found, the rightmost columns will contain NA.

Examples


potential_match(vec1=c("abc", "pigglywiggly"), vec2=c("abc", "rtyert", "piggly"), fancy=TRUE)


NRGI/nrgiR documentation built on April 3, 2022, 9:20 a.m.