I have a data.table
with a logical column. Why the name of the logical column can not be used directly for the i
argument? See the example.
From ?data.table
Advanced: When
i
is a single variable name, it is not considered an expression of column names and is instead evaluated in calling scope.
So dt[x]
will try to evaluate x
in the calling scope (in this case the global environment)
You can get around this by using (
or {
or force
dt[(x)]
dt[{x}]
dt[force(x)]