The agrep function gives some puzzling results and I'd like to understand its behavior better. For example:
agrep("abcd",c("abc","abcde","abcef"),value=T,max.distance = 1)
Returns:
[1] "abc" "abcde" "abcef"
But the distance between "abcd" and "abcef" is 2. So I'm not sure why the third match shows up.
levenshteinDist("abcd","abcef") # gives the answer of 2
Also, I assume that the function would return only exact matches if distance cap is set at 0:
agrep("abcd",c("abc","abcde","abcef"),value=T,max.distance = 0)
However, I get [1] "abcde"
as a match
It would be really helpful if someone could explain how the matching in agrep works.