keep_pattern {hacksaw}R Documentation

Grep, keep or discard a list or vector by pattern

Description

Grep, keep or discard a list or vector by pattern

Usage

keep_pattern(x, pattern, ...)

discard_pattern(x, pattern, ...)

Arguments

x

a list or vector.

pattern

string containing a regular expression to be matched in the given character vector.

...

additional arguments passed to grepl.

Value

A list.

Examples

l <- list("David", "Daniel", "Damien", "Eric", "Jared", "Zach")
l %>% keep_pattern("^D")
l %>% discard_pattern("^D")

[Package hacksaw version 0.0.2 Index]