Closed renkun-ken closed 10 years ago
It is probably the problem of data.table
. Consider the following test case:
First, define a function that simply subsets an object x
:
test <- function(x,...) {
x[...]
}
The run the following code:
> library(data.table)
> m <- data.table(x=1:3,key="x")
> m[J(1)]
x
1: 1
> local({i <- 1; m[J(i)]})
x
1: 1
> local({i <- 1; test(m, J(i))})
Error in eval(expr, envir, enclos) : object 'i' not found