Returns a logical vector of elements of x matching the regex y.
Arguments
- x
a vector (numeric, character, factor)
- pattern
a vector (numeric, character, factor), matching the mode of x
Value
A logical vector with length equal to x
of things in x
that are like y
.
Examples
(Name <- c("Mary","George","Martha"))
#> [1] "Mary" "George" "Martha"
Name %in% c("Mary")
#> [1] TRUE FALSE FALSE
Name %like% "^Mar"
#> [1] TRUE FALSE TRUE
Name %nin% c("George")
#> [1] TRUE FALSE TRUE
Name %nlike% "^Mar"
#> [1] FALSE TRUE FALSE