potential_match: Find potential matches for a vector against another

Description Usage Arguments Value Examples

View source: R/potential_match.R

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

1
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

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

NRGI/nrgiR documentation built on Dec. 7, 2018, 7:59 a.m.