Returns the index of the first match in a reference table

Description

This function provides a modified behaviour of match in the case of multiple matches, where it returns the index of the first match.

Usage

match_first(x, table, nomatch = NA_integer_, incomparables = NULL)

Arguments

x
vector or NULL: the values to be matched. Long vectors are supported.
table
vector or NULL: the values to be matched against. Long vectors are not supported.
nomatch
the value to be returned in the case when no match is found. Note that it is coerced to integer.
incomparables
a vector of values that cannot be matched. Any value in x matching a value in this vector is assigned the nomatch value. For historical reasons, FALSE is equivalent to NULL.

See also

match, charmatch