grapes-match-grapes: %match%: Case-insensitive match returning indices

%match%R Documentation

%match%: Case-insensitive match returning indices

Description

Performs case-insensitive matching, like base::match(), but ignores letter case.

Usage

x %match% table

Arguments

x

Character vector to match.

table

Character vector of values to match against.

Value

An integer vector of the positions of matches of x in table, like base::match(). Returns NA for non-matches. Returns an integer(0) if x is length 0.

Examples

# Basic matching
c("tp53", "BRCA1", "egfr") %match% c("TP53", "EGFR", "MYC")
# returns: 1 NA 2

# No matches returns: all NA
c("aaa", "bbb") %match% c("xxx", "yyy")

# Empty input
character(0) %match% c("a", "b")

# Order sensitivity (like match): first match is returned
c("x") %match% c("X", "x", "x")
# returns: 1

evanverse documentation built on March 10, 2026, 5:07 p.m.