match_pattern: Pattern Matching

Description Usage Arguments Details Examples

Description

Extract values from a vector that match a particular pattern.

Usage

1
match_pattern(x, pattern, unique_only = FALSE, ...)

Arguments

x

A vector, typically of class "character".

pattern

Character string specifying the particular pattern to match.

unique_only

Logical indicating whether or not to only return unique values. Default is FALSE.

...

Additional optional arguments to ba passed onto get_pattern.

Details

The pattern specified by the required argument pattern must be a valid pattern produced by the get_pattern function. That is, all digits should be represented by a "9", lowercase/uppercase letters by a "a"/"A", etc.

Examples

1
2
3
phone <- c("123-456-7890", "456-7890", "123-4567", "456-7890")
match_pattern(phone, pattern = "999-9999")
match_pattern(phone, pattern = "999-9999", unique_only = TRUE)

bgreenwell/bpa documentation built on May 12, 2019, 8:19 p.m.