matchAll {tuple} | R Documentation |
Extends the functionality of match
to identify
all matching values, instead of just the first one.
matchAll(x, table)
x |
A vector. |
table |
The lookup table as a vector. |
Returns an integer vector of the index in table
for all
the matches. The result is not sorted in numerical index order when
more than one value is sought to be matched.
Instead, the matches of the first value in x
are listed first,
followed by matches to the second value in x
and so on.
Values of NA
are treated as data.
matchAll(3, c(1:3, 3, 4:6, 3, NA, 4))
matchAll(3:4, c(1:3, 3, 4:6, 3, NA, 4))
matchAll(c(NA, 3:4), c(NA, 1:3, 3, 4:6, 3, NA, 4))