powered by
Removes the matching elements of a vector.
filter_element(x, pattern, ...)
A character vector.
A regex pattern to match for exclusion.
Other arguments passed to grep.
grep
Returns a vector with matching elements removed.
# NOT RUN { x <- c('dog', 'cat', 'bat', 'dingo', 'dragon', 'dino') filter_element(x, '^d.+?g') filter_element(x, 'at$') filter_element(x, '^d') filter_element(x, '\\b(dog|cat)\\b') # }
Run the code above in your browser using DataLab