x, the position in
table or unique
completion whose initial substring matches that element.
pmatch(x, table, nomatch=NA, duplicates.ok=F)
bdCharacter of items to be matched sequentially in
table,
using the partial match algorithm.
bdCharacter giving the possible values in
x.
x does not uniquely
match any item in
table.
FALSE, duplicate values in
x correspond to
nomatch; this is the way to simulate function call name matching.
TRUE.
bdNumeric like
x giving, for each element of
x, the position
in
table of the first
table[i] whose initial substring
uniquely matches that element.
Matching is done by the same algorithm used to match named arguments in
S-PLUS function calls; see Section 11.3.5 of Becker, Chambers and Wilks.
However,
pmatch does not match empty strings, in contrast to the
argument-matching algorithm, which matches unnamed arguments positionally
after dealing with named arguments.
The
charmatch function is a close synonym of
pmatch.
See the documentation for
charmatch for a comparison of their differences.
pmatch("Ala",state.name) # is NA (could match Alaska or Alabama)
pmatch("Alab",state.name) # is 1, matching Alabama
# given names, possibly truncated versions of state names
# produce the full state names
state.name[pmatch(names,state.name)]