Closed mkoohafkan closed 2 years ago
Yep - this occurs because testDT
isn't data.table
"aware". Until #184 is fixed all you need to do is define .datatable.aware <- TRUE
somewhere in your package.
You can see here for an example. You only need to do this once btw, it doesn't need to be done for each function.
# devtools::install_github("markfairbanks/turbo-octo-invention@datatable-aware")
library(testDT)
test_dt()
#> [1] 6 4 8
I'm going to close this issue since it's a duplicate of #184, but if you have any further questions let me know.
Oh that's excellent, thank you! I did see Hadley's comment about checking for .datatable.aware
in the evaluation environment but I didn't make the connection that I could simply add that statement to my own package.
Probably related issues:
Using functions from a package that imports
dtplyr
can result in errors that do not occur when running the same code directly. I suspect it has something to do withdtplyr
's ability to accessdata.table
namespace whendtplyr
is imported by a package vs being called from the top-level environment. I created a reprex package here: https://github.com/mkoohafkan/turbo-octo-invention which contains a single function (contents copied below):And here's the reprex:
Running the code directly is fine: