colc: search column names based on regex

Description Usage Arguments Value Examples

View source: R/colc.R

Description

search column names based on a regex, possibly exclude some elements based on another regex, and include some other elements (not regex but identical). For selection of columns for use in various situations

Usage

1
colc(DT, x = NA, not = NA, plus = NA, ignore.case = TRUE)

Arguments

DT

a character vector. if a data.frame, uses the colnames() to extract a character vector with the colnames

x

a regex to search for in DT

not

a regex that will exclude these from argument x. Note that this uses grepl, and since grepl is not vectorized, if several elements are supplied, they are stringed together with '|' in grepl.

plus

a character vector with specific elements from the string that will be included. the function will trhow an error if these do not exist in the vector.

ignore.case

should cases be ignored? Default is TRUE

Value

This function returns a character vector that matches the regex search pattern

Examples

1
2
3
4
## Not run: 
colc(dupstestdata)

## End(Not run)

emilBeBri/dttools documentation built on April 21, 2021, 5:44 a.m.