match {linq} R Documentation

Value Matching

Description


match returns a vector of the positions of
(first) matches of its first argument in
its second.

find the index of the elements in input sequence
`x` in the source target sequence
`table`


find the index of (where x in table)

Usage

match(x, table,
    nomatch = -1,
    incomparables = 0);

Arguments

x

vector or NULL: the values to be matched. Long vectors are supported. [as Array]

table

vector or NULL: the values to be matched against. Long vectors are not supported. (using as index object.). [as Array]

nomatch

the value to be returned in the case when no match is found. Note that it is coerced to integer. [as 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. [as integer]

Details

https://stackoverflow.com/questions/7530765/get-the-index-of-the-values-of-one-vector-in-another

 first  = c("a", "c", "b");
 second = c("c", "b", "a");
 match(second, first);
 
 #   c b a  <-second 
 [1] 2 3 1

Authors

SMRUCC genomics Institute

Value

A vector of the same length as x. An integer vector giving the position in table of the first match if there Is a match, otherwise nomatch. If x[i] Is found To equal table[j] Then the value returned In the i-th position Of the Return value Is j, For the smallest possible j. If no match Is found, the value Is nomatch.

clr value class

Examples


[Package linq version 2.33.856.6961 Index]