-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Standard evaluation functions #25
Comments
Hmm, that's not a bad suggestion to be honest. I guess I need to decide what I want As for the |
Not sure if it works for everything, but in this case you could wrap it with eval(substitute(...)):
Love what you're doing with this package |
That's a great solution 😄 I should have thought of that really 😅 and thank you, I will continue developing and adding more stuff - I have some pretty big plans. |
Personally, I would recommend against adding functions to poorman. Going from dplyr -> poorman is important, but potentially also going from poorman -> dplyr. |
Yes that is a very valid point. Thus far, I am trying to copy the API exactly and so adding these functions would go against that design philosophy. Food for thought! |
FYI in relation to this original question. Another way to solve the problem which is similar to avg <- function(data, what, by) {
by <- substitute(by)
what <- substitute(what)
eval(bquote(
data %>%
group_by(.(by)) %>%
summarise(avg = mean(.(what)))
))
}
mtcars %>% avg(mpg, am) |
That's a neat solution @nathaneastwood! Regarding @bwiernik's comment, I actually don't see many going the |
So my ambition is that I can have the best of both worlds in a single function. But I haven’t quite worked out all of the details just yet. We shall see. |
I very much like the idea that not only should code written with An expanded package would therefore be my preference for any extra functions or features, and that package could import and re-export the |
There could be a poormanExtra package for functions that do not correspond to tidyverse. That would make it clear what is reverseable and what not. |
{dplyr}
used to offer verbs with standard evaluation, e.g.mutate_()
. Unfortunately, these have been deprecated. I think they are super useful, though, and would love to see them in{poorman}
.On a related note, how would one turn a
{poorman}
chain into a function? With{dplyr}
and{rlang}
I'd do something like this:I guess this would do the job with
{poorman}
?The text was updated successfully, but these errors were encountered: