filter_element: Remove Elements in a Vetor

Description Usage Arguments Value Examples

View source: R/filter_element.R

Description

Removes the matching elements of a vector.

Usage

1

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

1
2
3
4
5
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')

Example output

[1] "cat"  "bat"  "dino"
[1] "dog"    "dingo"  "dragon" "dino"  
[1] "cat" "bat"
[1] "bat"    "dingo"  "dragon" "dino"  

textclean documentation built on May 2, 2019, 7:22 a.m.