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

slice doesn't respect group_by for data.tables #717

Closed
momeara opened this issue Oct 22, 2014 · 0 comments
Closed

slice doesn't respect group_by for data.tables #717

momeara opened this issue Oct 22, 2014 · 0 comments
Assignees
Labels
Milestone

Comments

@momeara
Copy link

@momeara momeara commented Oct 22, 2014

From the documentation for slice:

> mtcars %>% group_by(cyl) %>% slice(1)
 Source: local data frame [3 x 11]
 Groups: cyl

    mpg cyl disp  hp drat   wt  qsec vs am gear carb
 1 22.8   4  108  93 3.85 2.32 18.61  1  1    4    1
 2 21.0   6  160 110 3.90 2.62 16.46  0  1    4    4
 3 18.7   8  360 175 3.15 3.44 17.02  0  0    3    2

but doing the same thing after converting it to a data.table gives

> mtcars %>% as.data.table %>% group_by(cyl) %>% slice(1)
    mpg cyl disp hp drat   wt  qsec vs am gear carb
 1 22.8   4  108 93 3.85 2.32 18.61  1  1    4    1
@hadley hadley added the bug label Oct 30, 2014
@hadley hadley added this to the 0.3.1 milestone Oct 30, 2014
@hadley hadley self-assigned this Oct 30, 2014
@hadley hadley closed this in 3688b59 Nov 19, 2014
@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
2 participants