gbp icon indicating copy to clipboard operation
gbp copied to clipboard

data.table Depends->Imports

Open MichaelChirico opened this issue 5 years ago • 2 comments

Thanks for using data.table! We noticed you are Depending on us and recently decided to strongly discourage downstream packages from doing so -- we think Imports is always better.

This PR attempts to make the migration from Depends to Imports for data.table.

If you have a strong reason for preferring Depends, we'd love to hear it over at our issue tracker:

https://github.com/Rdatatable/data.table/issues/3076

MichaelChirico avatar Sep 22 '19 06:09 MichaelChirico

HI, @MichaelChirico ,

Could you advice me on defining .N and := in bpp_viewer.r?

.N = NULL
`:=` = function(...) NULL

I think we want .N and := to be called from data.table, but what would happen when we overwrote them local (i mean bpp_viewer.r)?

Thank you very much!

gyang274 avatar Sep 24 '19 22:09 gyang274

data.table also defines .N as NULL and := to be a dummy function.

.N and := are done with non-standard evaluation within [.data.table -- we examine the expression and look specifically for these (and other) symbols and then interpret them within that context.

Moreover, in terms of inheritance, when .N is being used in your package, it's evaluated by [.data.table, the parent environment of which is the data.table package environment, where .N is defined as NULL by us.

So, the value you define in your package environment is (1) never seen by data.table and (2) not on the right inheritance path anyway -- the version in data.table will always be seen first.

Doing this is just a ruse to trick R CMD check into passing your package while using NSE variables :)

MichaelChirico avatar Sep 25 '19 03:09 MichaelChirico