select_grep {hutils} | R Documentation |
Select names matching a pattern
Description
Select names matching a pattern
Usage
select_grep(
DT,
patterns,
.and = NULL,
.but.not = NULL,
ignore.case = FALSE,
perl = TRUE,
fixed = FALSE,
useBytes = FALSE,
invert = FALSE,
.warn.fixed.mismatch = TRUE
)
Arguments
DT |
A |
patterns |
Regular expressions to be matched against the names of |
.and |
Character or integer positions of names to select, regardless of whether or not they are matched by |
.but.not |
Character or integer positions of names to drop, regardless of whether or not they are matched by |
ignore.case , perl , fixed , useBytes , invert |
Arguments passed to |
.warn.fixed.mismatch |
(logical, default: |
Value
DT
with the selected names.
integer vector of positions
Examples
library(data.table)
dt <- data.table(x1 = 1, x2 = 2, y = 0)
select_grep(dt, "x")
select_grep(dt, "x", .and = "y")
select_grep(dt, "x", .and = "y", .but.not = "x2")