list-ops: Grep, keep or discard a list or vector by pattern

Description Usage Arguments Value Examples

Description

Grep, keep or discard a list or vector by pattern

Usage

1
2
3

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

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

hacksaw documentation built on Jan. 13, 2021, 7:57 a.m.