Select names matching a pattern
select_grep(DT, patterns, .and = NULL, .but.not = NULL, ignore.case = FALSE, perl = TRUE, fixed = FALSE, useBytes = FALSE, invert = FALSE, .warn.fixed.mismatch = TRUE)
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: |
DT
with the selected names.
integer vector of positions
#> x1 x2 #> 1: 1 2select_grep(dt, "x", .and = "y")#> x1 x2 y #> 1: 1 2 0select_grep(dt, "x", .and = "y", .but.not = "x2")#> x1 y #> 1: 1 0