"Defined but not used" flag misses "parent scope" notation in data.table


#1

Recently, data.table allows .. prefix to allow reference to parent-scoped variables in j:

library(data.table)
v_names = c('a', 'b')

DT = data.table(a = 1:3, b = 4:6, c = 7:9)
# allows subsetting to 'a' and 'b' dynamically,
#   as a work-around to the default 'with'
#   behavior of data.table scoping
DT[ , ..v_names]

If this is the complete script, RStudio will throw a warning on the vnames line if the “warn about unused variables” flag is on.