I have a data.table object on which I'd like to do a simple lookup:
print(class(dt))
print(colnames(dt))
print(dt[region == "UK", ])
In my interactive R session, this chunk 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 scripted 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 dispatching dt[.... to [.data.frame rather than to [.data.table.  Any thoughts as to why?
 
     
    