Learn R Programming

textclean (version 0.9.3)

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

Run this code
# 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