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

Cannot use last/first with order_and subsets #626

Closed
jamiefolson opened this issue Sep 25, 2014 · 3 comments
Closed

Cannot use last/first with order_and subsets #626

jamiefolson opened this issue Sep 25, 2014 · 3 comments
Assignees
Labels
Milestone

Comments

@jamiefolson
Copy link

@jamiefolson jamiefolson commented Sep 25, 2014

If you try to use last or first with an order_by= value that's a subset expression, it fails:

library(dplyr)
summarize(group_by(mtcars,cyl),bigmpg=last(mpg,order_by=wt))
# Source: local data frame [3 x 2]
#
#   cyl bigmpg
#1   4   24.4
#2   6   18.1
#3   8   10.4
summarize(group_by(mtcars,cyl),bigmpg=last(mpg[drat>3],order_by=wt[drat>3]))
# Error: invalid order_by
@hadley hadley added the bug label Sep 30, 2014
@hadley hadley added this to the 0.3.1 milestone Sep 30, 2014
@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Oct 3, 2014

ah. The assumption I guess I made is that we would only use order_by = symbol.
Those kind of assumptions allow me to optimise code. I'll keep the fast code for the default and augment the capabilities for other cases.

Loading

@jamiefolson
Copy link
Author

@jamiefolson jamiefolson commented Oct 3, 2014

Yeah, that's what it seemed like was happening, since it works outside of summarize. Thanks!

Loading

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Oct 3, 2014

All fixed now (in the dev_0_3_1 branch for now). Please reopen if it does not work for you.

Loading

@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants