str_subset_name: subset a vector by matching names against a pattern

Description Usage Arguments Examples

View source: R/tools.R

Description

This function is inspired by str_subset from stringr

Usage

1
2
3
str_subset_name(vec, pattern)

str_subset_name(vec, pattern) <- value

Arguments

vec

named vector

pattern

regex as in str_subset

Examples

1
2
myvec <- c("a", "b", "ab", "ba") %>% are_names_of(runif)
myvec %>% str_subset_name("^a")

dlill/conveniencefunctions documentation built on Aug. 11, 2018, 1:03 p.m.