Skip to content

A function that emulates dplyr's .contains helper function combined with select, to subset columns combining a list and a pattern.

Usage

keep_cols(DT, pattern, ...)

Arguments

DT

a data.table to obtain column names from.

pattern

a string containing the patterns to look for in the column names

...

other arguments coming from the grep function

Value

a vector to be plugged into a data.table's "..j" for subsetting.

Author

Alejandro Abraham a.abraham@innovationteam.eu