agrep {base} | R Documentation |
Searches for approximate matches to pattern
(the first argument)
within the string x
(the second argument) using the Levenshtein
edit distance.
agrep(pattern, x, ignore.case = FALSE, value = FALSE, max.distance = 0.1)
pattern |
a non-empty character string to be matched (not a regular expression!) |
x |
character vector where matches are sought. |
ignore.case |
if |
value |
if |
max.distance |
Maximum distance allowed for a match. Expressed either as integer, or as a fraction of the pattern length (will be replaced by the smallest integer not less than the corresponding fraction), or a list with possible components
If |
The Levensthein edit distance is used as measure of approximateness: it is the the total number of insertions, deletions and substitutions required to transform one string into another.
The function is a simple interface to the apse
library
developed by Jarkko Hietaniemi (also used in the Perl String::Approx
module).
Either a vector giving the indices of the elements that yielded a
match, of, if value
is TRUE
, the matched elements.
David Meyer David.Meyer@ci.tuwien.ac.at (based on C code by Jarkko Hietaniemi); modifications by Kurt Hornik
grep
agrep("lasy", "1 lazy 2")
agrep("lasy", "1 lazy 2", max = list(sub = 0))
agrep("laysy", c("1 lazy", "1", "1 LAZY"), max = 2)
agrep("laysy", c("1 lazy", "1", "1 LAZY"), max = 2, value = TRUE)
agrep("laysy", c("1 lazy", "1", "1 LAZY"), max = 2, ignore.case = TRUE)