Niklaus Kuehnis
2011-Jun-23 13:59 UTC
[R] agrep: How to match with more than 1 substitution?
Hi all I'm trying to match a numeric code to a vector of numeric codes: a <- c(12345, 12346, 12347) agrep(12349, a, max.distance=list(substitutions=1)) # [1] 1 2 3 agrep(12399, a, max.distance=list(substitutions=2)) # integer(0) I didn't expect the latter result as substituting two characters from the pattern makes the pattern identical to the vector elements. What do I need to change to match with more than 1 substitution allowed? Thanks in advance, Nik