Present since hutils 1.2.0
.
selector(DT, ..., cols = NULL, preserve.key = TRUE, shallow = FALSE)
DT | A |
---|---|
... | Unquoted columns names. |
cols | Character vector of column names. |
preserve.key | (logical, default: |
shallow | (logical, default: |
DT
with the selected columns.
RQ("nycflights13", no = { library(nycflights13) library(data.table) fs <- as.data.table(flights) fs1 <- selector(fs, year, month, day, arr_delay) fs1[, arr_delay := NA] })#> year month day arr_delay #> 1: 2013 1 1 NA #> 2: 2013 1 1 NA #> 3: 2013 1 1 NA #> 4: 2013 1 1 NA #> 5: 2013 1 1 NA #> --- #> 336772: 2013 9 30 NA #> 336773: 2013 9 30 NA #> 336774: 2013 9 30 NA #> 336775: 2013 9 30 NA #> 336776: 2013 9 30 NA