matchAll: Match All Values

Description Usage Arguments Details See Also Examples

Description

Extends the functionality of match to identify all matching values, instead of just the first one.

Usage

1

Arguments

x

A vector.

table

The lookup table as a vector.

Details

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.

See Also

match

Examples

1
2
3
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))

Example output

[1] 3 4 8
[1]  3  5  4 10  8
[1]  1  4  6 10  5 11  9

tuple documentation built on May 2, 2019, 12:39 a.m.