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

Data.table and group named "V1" #615

Closed
matthieugomez opened this issue Sep 20, 2014 · 0 comments
Closed

Data.table and group named "V1" #615

matthieugomez opened this issue Sep 20, 2014 · 0 comments
Assignees
Labels
Milestone

Comments

@matthieugomez
Copy link

@matthieugomez matthieugomez commented Sep 20, 2014

There is an issue in filter if the dataset object is a data.table and the variable by which the variable is grouped is named "V1".

library(dplyr)
library(hflights)
library(data.table)
DT <- as.data.table(hflights)
DT %>% group_by(DayOfWeek) %>% filter(ArrTime==1502) %>% nrow
[1] 173
setnames(DT,"DayOfWeek","V1")
 DT %>% group_by(V1) %>% filter(ArrTime==1502) %>% nrow
[1] 3239

It happens because of this line of code:

call <- substitute(data[, .I[expr], by = vars])
indices <- eval(call, env)$V1
@hadley hadley added the bug label Sep 22, 2014
@hadley hadley added this to the 0.3.1 milestone Sep 22, 2014
@hadley hadley self-assigned this Sep 22, 2014
@hadley hadley closed this in 225f01b 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