-
Notifications
You must be signed in to change notification settings - Fork 991
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
How do .I and .SD work? #3668
Comments
From what I can tell, the Line 891 in dbb0d0b
If they are found, then they'll be added to the environment, so these variants work:
This is not idiomatic metaprogramming, and will interfere with optimization:
... while A couple idioms are
|
For my purposes it seems like it'll be easiest to generate |
@hadley If you're planning on making Here's an example to illustrate this:
|
Ok, then |
It is a very nice explanation. Could you please also illuminate a little bit about the difference between seq_len(.N) and 1:.N? I have been using 1:.N and it is my first time know seq_len(.N). But, it doesn't work in this way: |
@ghowoo
Please note that these sorts of questions are usually best addressed on StackOverflow (so that bugs, feature requests, and other issues are not lost amid usage questions). I assume hadley is being given a little leeway because he is developing |
@ |
@hadley I think @franknarf1's explanation is pretty much on point. FWIW I'll add this related issue: #1206 -- |
@MichaelChirico FWIW in dplyr we avoid doing computation when it's not needed by using active bindings in the evaluation environment; that avoids the need to do static analysis of the input expressions (which we try to avoid as much as possible). |
I can access
.N
from inside a function inside a data table by evaluating in the parent frame. The same technique doesn't work for.I
and.SD
. Are they only created lazily if they appear in the AST?Created on 2019-06-27 by the reprex package (v0.2.1.9000)
The text was updated successfully, but these errors were encountered: