-
Notifications
You must be signed in to change notification settings - Fork 990
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
mention options in importing vign #3578
Conversation
vignettes/datatable-importing.Rmd
Outdated
## Avoid of package options | ||
|
||
Common practice is to provide customization of various options globally for a package using `options` function. `data.table` is no exception here. Use of options of your dependency package should be avoided inside your package, and use of options by end user should be used with extra care. The reason for that is because those options works globally, for your package, other packages, and user's code. | ||
Consider the case when `data.table` is imported by `pkgX`, where `pkgX` compute a join. Then an end user sets `options(datatable.nomatch=NULL)`, as a result join performed by `pkgX` is now an inner join, not outer join. Options are generally safe when you work just with `data.table`, or the package you are developing will be an internal package that will work just with `data.table`. Remember that global options should be well documented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A safe alternative is to set/reset options when needed, but this is strictly dominated for data.table
because all options could be set explicitly in the function calls (I think?)
Discovered a case where it appears impossible to avoid using options() here:
https://twitter.com/michael_chirico/status/1126737388393230336
Codecov Report
@@ Coverage Diff @@
## master #3578 +/- ##
=========================================
+ Coverage 97.58% 98.19% +0.6%
=========================================
Files 66 66
Lines 12695 12922 +227
=========================================
+ Hits 12389 12689 +300
+ Misses 306 233 -73
Continue to review full report at Codecov.
|
I fear it's not sufficient to just document this. There should be something more robust. I've been aware of this issue for some time and have not created any new options that affect behavior, only to manage migration temporarily and stated in news that those options will eventually be removed (e.g.
Here are all the options as of now in dev : https://github.com/Rdatatable/data.table/blob/master/R/onLoad.R#L44. Other than the those two ( This does mean we should try to remove |
The thing with on=.NATURAL, is the user needs to know what a natural join is. That name comes from SQL. A lot of them don't seem to know SQL and find SQL difficult. Also .NATURAL is a bit long to type. |
suggestion of I would suggest |
Agree about options risky behaviour. There is a way to detect if call was made from package There are many potential options already mentioned... |
Yes but to me, what is "natural" is |
Blue sky idea: passing a DT to |
it's neat and could work, but are you proposing a replacement to the new feature? The fundamental use case of " |
just accessing the new feature with a different api, to avoid the new symbol and new option, and currently I'm quite liking it too even if it didn't avoid the new symbol and option.
Fundamental to data.table is that |
No description provided.