[R] agrep confusion

Paul Galpern pgalpern at gmail.com
Mon Oct 26 03:17:28 CET 2009


I am sure there is something I am just not understanding about agrep 
functionality. 

str1 <- c("ab","aba","abc")
agrep("abc",str1, max.distance = list(insertions=0, substitutions=0, 
deletions=1), value=T)

returns:
[1] "ab"  "aba" "abc"

Why is "aba" a match?  It seems to me that this should require a 
substitution and this has been set to 0 in max.distance.  Alternatively 
this would require a deletion plus an insertion but, again, not 
permitted in arguments.

Thanks for your help,

Paul Galpern
PhD Candidate
Natural Resources Institute
University of Manitoba
Winnipeg, Manitoba, Canada




More information about the R-help mailing list