Description Usage Arguments Value Author(s) References Examples
Function to compare the similarity of two different character strings
1 | 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
1 2 3 4 5 6 7 8 9 10 11 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.