stringMatch {MiscPsycho} | R Documentation |
Function to compare the similarity of two different character strings
stringMatch(string.1, string.2, normalize = c("YES", "NO"), penalty = 1, case.sensitive = FALSE)
string.1 |
The first character string |
string.2 |
The second character string |
normalize |
a character string indicating which method to use; if normalize = 'YES', then the edit distance is normalized to fall in the interval [0,1] |
penalty |
The edit cost |
case.sensitive |
logical; if TRUE, then a penalty occurs for differences in case of a character |
a numeric value. If normalize = 'YES"
, then the edit distance is normalized to fall in the interval [0,1]. Else, the Levenshtein edit distance is returned.
Harold C. Doram
http://en.wikipedia.org/wiki/Levenshtein_distance
## Return edit distance stringMatch('William Clinton', 'Bill Clinton', normalize='NO') ## Return normalized edit distance stringMatch('William Clinton', 'Bill Clinton', normalize='YES') ## Ignore differences in case stringMatch('Bill Clinton', 'bill Clinton', normalize='YES', case.sensitive = FALSE) ## Do not ignore differences in case stringMatch('Bill Clinton', 'bill Clinton', normalize='YES', case.sensitive = TRUE)