Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

filter_element

Remove Elements in a Vetor


Description

Removes the matching elements of a vector.

Usage

filter_element(x, pattern, ...)

Arguments

x

A character vector.

pattern

A regex pattern to match for exclusion.

...

Other arguments passed to grep.

Value

Returns a vector with matching elements removed.

Examples

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')

textclean

Text Cleaning Tools

v0.9.3
GPL-2
Authors
Tyler Rinker [aut, cre], ctwheels StackOverflow [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.