match_pattern {bpa} | R Documentation |
Pattern Matching
Description
Extract values from a vector that match a particular pattern.
Usage
match_pattern(x, pattern, unique_only = FALSE, ...)
Arguments
x |
A vector, typically of class |
pattern |
Character string specifying the particular pattern to match. |
unique_only |
Logical indicating whether or not to only return unique
values. Default is |
... |
Additional optional arguments to ba passed onto
|
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
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)
[Package bpa version 0.1.1 Index]