Like Operator
The like operator is a simple wrapper for grep(..., value=TRUE)
, whose complexity is hard to crack for R-newbies.
x %like% pattern x %like any% pattern
x |
a vector, typically of character or factor type |
pattern |
simple character string to be matched in the given character vector. |
Follows the logic of simple SQL or basic commands.
a vector (numeric, character, factor), matching the mode of x
Andri Signorell <andri@signorell.net>
match
, pmatch
, grep
, %[]%
, %overlaps%
# find names ending on "or" names(d.pizza) %like% "%or" # find names starting with "d" names(d.pizza) %like% "d%" # ... containing er? names(d.pizza) %like% "%er%" # and combined, search for a name containing "un", ending on "or" # or beginning with "F" levels(d.pizza$driver) %like any% c("%un%", "%or", "F%") # the positions on the vector match(names(d.pizza) %like% "%er%", names(d.pizza))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.