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

Comments

Projects
2 participants
@JohnMount

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

This comment has been minimized.

Show comment
Hide comment
@krlmlr

krlmlr Sep 15, 2017

Member

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

Member

krlmlr commented Sep 15, 2017

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

@krlmlr krlmlr added this to To-do in krlmlr Dec 18, 2017

@krlmlr krlmlr moved this from To-do to Done in krlmlr Dec 31, 2017

krlmlr added a commit to krlmlr/dplyr that referenced this issue Dec 31, 2017

Merge branches 'b-#3085-cbind-error', 'b-#3071-summarize-zero-columns…
…', 'b-#3266-join-clash' and 'b-#3258-named' into r-0.7.5

krlmlr added a commit to krlmlr/dplyr that referenced this issue Jan 6, 2018

@krlmlr krlmlr closed this in #3274 Feb 3, 2018

@lock

This comment has been minimized.

Show comment
Hide comment
@lock

lock bot 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 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.