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

Avoid duplicated columns in count, tally, and summarise #295

Merged
merged 6 commits into from
Sep 7, 2021

Conversation

eutwt
Copy link
Collaborator

@eutwt eutwt commented Sep 4, 2021

This fixes the following errors (and instead produces results matching dplyr)

library(dtplyr)
library(dplyr, warn.conflicts = FALSE)
dt <- lazy_dt(data.frame(a = 2, n = 3))

dt %>% 
  count(a, name = 'a') %>% 
  as_tibble()
#> Error: Column name `a` must not be duplicated.
#> Use .name_repair to specify repair.

dt %>% 
  group_by(a) %>% 
  summarise(a = 1) %>% 
  as_tibble()
#> Error: Column name `a` must not be duplicated.
#> Use .name_repair to specify repair.

dt %>% 
  count(n) %>% 
  as_tibble()
#> Error: Column name `n` must not be duplicated.
#> Use .name_repair to specify repair.

Created on 2021-09-04 by the reprex package (v2.0.1)

@eutwt
Copy link
Collaborator Author

eutwt commented Sep 4, 2021

I gave a name to an input in one of the pivot_wider tests because earlier the snapshot of the expression was showing a different name, e.g. setnames(dcast(`_DT17`... instead of setnames(dcast(`_DT12`..., causing the test to fail.

@hadley hadley merged commit 73d2960 into tidyverse:master Sep 7, 2021
@hadley
Copy link
Member

hadley commented Sep 7, 2021

Thanks!

@eutwt eutwt deleted the cvn2 branch September 7, 2021 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants