grapes-em-grapes: Binary Operator for Exact Matches

%em%R Documentation

Binary Operator for Exact Matches

Description

The binary operator %em% returns a logical vector indicating if there is a exact match against its left operand.

Usage

x %em% y

Arguments

x

A vector of values to be matched.

y

The value to be partially matched against.

Details

This operator is robust against NA, returning TRUE if y equals NA and FALSE otherwise.

Value

A logical vector equal to TRUE for all elements in x that exactly match y.

Author(s)

Kevin Potter

Examples

x <- c( "Cat", "Dog", "Bat" )
x %em% "Cat"

# Can match NA
x[2] <- NA
x %em% "Cat"
x %em% NA


rettopnivek/camrprojects documentation built on March 26, 2024, 9:17 a.m.