names_with: Easily Select Elements from a Character Vector

Description Usage Arguments Examples

View source: R/names_with.r

Description

This function returns elements that contain characters specified in with and do not contain characters specified in without

Usage

1
names_with(names, with = NULL, without = NULL)

Arguments

names

A character vector

with

A character vector of items we want names to contain. Default to NULL.

without

A character vector of items we do not want names to contain. Default to NULL.

Examples

1
2
3
4
5
6
7
names <- c('one', 'two', 'three', 'three3')
with <- c('one', 'three')
without <- c('three3')

names_with(names, with, without) ##returns c('one', 'three')

names_with(names, with) ##returns c('one', 'three', 'three3')

joshua-ruf/fidelis documentation built on July 20, 2019, 1:56 a.m.