pmatch seeks matches for the elements of its first argument among those of its second.
pmatch(x, table, nomatch = NA_integer_, duplicates.ok = FALSE)
| Parameter | Description |
|---|---|
x |
the values to be matched: converted to a character vector by as.character. Long vectors are supported. |
table |
the values to be matched against: converted to a character vector. Long vectors are not supported. |
nomatch |
the value to be returned at non-matching or multiply partially matching positions. Note that it is coerced to integer. |
duplicates.ok |
should elements be in table be used more than once? |
# NOT RUN {
pmatch("", "") # returns NA
pmatch("m", c("mean", "median", "mode")) # returns NA
pmatch("med", c("mean", "median", "mode")) # returns 2
pmatch(c("", "ab", "ab"), c("abc", "ab"), dup = FALSE)
pmatch(c("", "ab", "ab"), c("abc", "ab"), dup = TRUE)
## compare
charmatch(c("", "ab", "ab"), c("abc", "ab"))
# }