[R] agrep confusion

David Winsemius dwinsemius at comcast.net
Mon Oct 26 05:14:01 CET 2009


On Oct 25, 2009, at 10:17 PM, Paul Galpern wrote:

> 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?

The help page says that the parameters apply to the pattern, not the  
arguments.

  "ab" matches all of the offered arguments.

>  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
-- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list