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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to