-
Notifications
You must be signed in to change notification settings - Fork 977
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
programming on data.table #4304
Conversation
Really like the solution here. Desperately need programming with data.table in my code. The design looks concise and powerful enough for most of my use cases. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Codecov Report
@@ Coverage Diff @@
## master #4304 +/- ##
=======================================
Coverage 99.46% 99.46%
=======================================
Files 73 75 +2
Lines 14611 14706 +95
=======================================
+ Hits 14533 14628 +95
Misses 78 78
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@jan-glx I don't think there is a need for an extra dependency for something that base R can handle well. The only more tricky thing in base R metaprogramming is to substitute names of arguments, but this not less tricky with |
I feel like there would not be a conflict, just a - perhaps confusing - dual use of
The same would work in
or allow to use bare names in |
@jan-glx thanks for your input. understand there are different tastes but for me personally that version with all the one point worth mentioning about the So for me, a more representative use case would be:
|
I strongly agree with Michael about |
I think |
@jan-glx a very fresh example of confusing use of |
Most of my use case is programmatically determine the list to supply to dt[, X := Y + Z, env = list(X = paste0("x", i), Y = paste0("y", i), Z = paste0("z", i)) which looks much cleaner than X <- paste0("x", i)
Y <- paste0("y", i)
Z <- paste0("z", i)
dt[, !!X := !!Y + !!Z] in terms of the scoping of the |
Another example of feature suggested in this PR can be seen on this SO question which asks for quite complex parametrizing of DT query: https://stackoverflow.com/questions/24833247/how-can-one-work-fully-generically-in-data-table-in-r-with-column-names-in-varia |
Very excited to see the PR is finally merged. |
This PR is meant to introduce new (base-R like) interface for parametrizing data.table queries. #2655
It uses base R
substitute
style substitution, but extends it for substitution of names of the argument in a function calls. This allows to give names of a columns from a variables as well, which is not possible using just base R substitute.working example, checkout to
programming
branch, startR
Feedback welcome!