%em% | R Documentation |
The binary operator %em%
returns a logical
vector indicating if there is a exact match against its left
operand.
x %em% y
x |
A vector of values to be matched. |
y |
The value to be partially matched against. |
This operator is robust against NA
, returning
TRUE
if y
equals NA
and FALSE
otherwise.
A logical vector equal to TRUE
for all elements
in x
that exactly match y
.
Kevin Potter
x <- c( "Cat", "Dog", "Bat" )
x %em% "Cat"
# Can match NA
x[2] <- NA
x %em% "Cat"
x %em% NA
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.