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

dplyr::tally does not work for data.frame with no columns #3071

Closed
JohnMount opened this issue Sep 3, 2017 · 2 comments
Closed

dplyr::tally does not work for data.frame with no columns #3071

JohnMount opened this issue Sep 3, 2017 · 2 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@JohnMount
Copy link

JohnMount commented Sep 3, 2017

In attempting to find a good work-around for dplyr issue 3069 I ran into this. If we form a data.frame that happens to have no columns (by dropping a column), then dplyr::tally does not return a count.

suppressPackageStartupMessages(library("dplyr"))
packageVersion("dplyr")
#> [1] '0.7.2.9000'

data.frame(n = as.raw(1:3)) %>% 
  select(-n) %>% tally
#> data frame with 0 columns and 3 rows
@krlmlr
Copy link
Member

krlmlr commented Sep 15, 2017

Thanks, confirmed. Same behavior with summarise(n = n()).

@krlmlr krlmlr added bug an unexpected problem or unintended behavior data frame labels Sep 15, 2017
krlmlr added a commit to krlmlr/dplyr that referenced this issue Dec 31, 2017
…arize-zero-columns', 'b-tidyverse#3266-join-clash' and 'b-tidyverse#3258-named' into r-0.7.5
krlmlr added a commit to krlmlr/dplyr that referenced this issue Mar 13, 2018
@lock
Copy link

lock bot commented Aug 2, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Aug 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants