Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data.table Depends->Imports #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MichaelChirico
Copy link

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:

Rdatatable/data.table#3076

@gyang274
Copy link
Owner

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!

@MichaelChirico
Copy link
Author

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants