You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's pretty common in R to use a logical vector for selecting, but this fails:
> x <- data.table(b = c(FALSE, TRUE), d = 1:2)
> x
b d
1: FALSE 1
2: TRUE 2
> x[b]
Error in eval(expr, envir, enclos) : object 'b' not found
> x[(b)]
b d
1: TRUE 2
The problem can be avoided with more user friendly error message. For example:
Error in eval(expr, envir, enclos) : object 'b' not found
When 'i' is a single variable name, it is not considered an expression of column names and is instead evaluated in calling scope.
If 'b' is intended to be used as logical vector to index, wrap 'b' with () as expression.
The text was updated successfully, but these errors were encountered:
It's pretty common in R to use a logical vector for selecting, but this fails:
This is a frequent mistake, see here and here
The problem can be avoided with more user friendly error message. For example:
The text was updated successfully, but these errors were encountered: