%pm% | R Documentation |
The binary operator %pm%
returns a logical
vector indicating if there is a partial match against its left
operand (see base::grepl).
x %pm% 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 contain y
in some form.
Kevin Potter
x <- c( "Cat", "Dog", "Bat" )
x %pm% "at"
# Can match NA
x[2] <- NA
x %pm% "at"
x %pm% NA
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.