I have an object data.tableon which I would like to do a simple search:
print(class(dt))
print(colnames(dt))
print(dt[region == "UK", ])
In my interactive R session, this piece of code does exactly what it should.
[1] "data.table" "data.frame"
[1] "region" "site" "visit"
[4] "connectionfailure" "dnserror" "http404"
# ... output ...
In a non-interactive script session, I get a confusing error:
[1] "data.table" "data.frame"
[1] "region" "site" "visit"
[4] "connectionfailure" "dnserror" "http404"
Error in `[.data.frame`(x, i, j) : object 'region' not found
It looks like R is sending dt[....to [. data.frame , not [. data.table . Any thoughts on why?
source
share