match: Value matching

matchR Documentation

Value matching

Description

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

%in% is a binary operator that returns a logical vector of the length of its left operand indicating if the elements in it have a match or not.

NOTE: This man page is for the match and %in% S4 generic functions defined in the BiocGenerics package. See ?base::match for the default methods (defined in the base package). Bioconductor packages can define specific methods for objects (typically vector-like) not supported by the default methods.

Usage

match(x, table, nomatch=NA_integer_, incomparables=NULL, ...)

x %in% table

Arguments

x, table

Vector-like objects (typically of the same class, but not necessarily).

nomatch, incomparables

See ?base::match for a description of these arguments.

...

Additional arguments, for use in specific methods.

Value

The same as the default methods (see ?base::match for the value returned by the default methods).

Specific methods defined in Bioconductor packages should behave as consistently as possible with the default methods.

Note

The default base::match method (defined in the base package) doesn't have the ... argument. We've added it to the generic function defined in the BiocGenerics package in order to allow specific methods to support additional arguments if needed.

See Also

  • base::match for the default match and %in% methods.

  • showMethods for displaying a summary of the methods defined for a given generic function.

  • selectMethod for getting the definition of a specific method.

  • match,Hits,Hits-method and %in%,Rle,ANY-method in the S4Vectors package for examples of specific match and %in% methods (defined for Hits and Rle objects, respectively).

  • BiocGenerics for a summary of all the generics defined in the BiocGenerics package.

Examples

match  # note the dispatch on the 'x' and 'table' args only
showMethods("match")
selectMethod("match", c("ANY", "ANY"))  # the default method

`%in%`
showMethods("%in%")
selectMethod("%in%", c("ANY", "ANY"))  # the default method

Bioconductor/BiocGenerics documentation built on Nov. 17, 2024, 6:52 p.m.