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

Error with n() and data.table #579

Closed
matthieugomez opened this issue Sep 4, 2014 · 2 comments
Closed

Error with n() and data.table #579

matthieugomez opened this issue Sep 4, 2014 · 2 comments
Assignees
Labels
Milestone

Comments

@matthieugomez
Copy link

@matthieugomez matthieugomez commented Sep 4, 2014

library(data.table)
library(dplyr)
dt <- data.table(year = c(2000, 2001), name = c("Tom", "Tom"))
dt %>% group_by(year) %>% filter(n()==1)

gives the error
"Error in n() : This function should not be called directly"
but

library(data.table)
library(dplyr)
dt <- data.frame(year = c(2000, 2001), name = c("Tom", "Tom"))
dt %>% group_by(year) %>% filter(n()==1)

works.

@hadley hadley added the bug label Sep 11, 2014
@hadley hadley added this to the 0.3.1 milestone Sep 11, 2014
@hadley hadley self-assigned this Sep 11, 2014
@rbdixon
Copy link
Contributor

@rbdixon rbdixon commented Oct 12, 2014

Bummer... I just hit the same bug, too. I'll watch the thread for a commit. Thanks.

@hadley hadley closed this in aaaa94c Nov 20, 2014
@zslastman
Copy link

@zslastman zslastman commented Mar 24, 2015

I"m still experiencing this bug, and I'm using dplyr_0.4..

e.g.

mtcars%>%data.table%>%group_by(gear)%>%filter(n()>1)
Error in n() : This function should not be called directly

krlmlr pushed a commit to krlmlr/dplyr that referenced this issue Mar 2, 2016
@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
4 participants