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

Type inconsistency when selecting columns from tibble objectes created in different ways #3714

Closed
markvanderloo opened this issue Jul 17, 2018 · 2 comments
Labels

Comments

@markvanderloo
Copy link

@markvanderloo markvanderloo commented Jul 17, 2018

The following behaviour is inconsistent from the user's perspective

> class(group_by(iris, Species)[ , "Sepal.Width", drop=TRUE])
[1] "tbl_df"     "tbl"        "data.frame"
> class(as_tibble(iris)[ , "Sepal.Width", drop=TRUE])
[1] "numeric"

I understand that group_by creates a different subclass of tbl than as_tibble does, but for user experience I think that having consistent selection operators would be preferred.

My personal take: support drop=TRUE since that is more consistent with the generic [ method.

I ran into this because a user of one of my packages supplied a tibble object to a function while all my tests are on data frames.

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Jul 21, 2018

Thanks. I agree that we should support drop = TRUE because "grouped_df" is a subclass of "data.frame".

@krlmlr krlmlr added the bug label Jul 21, 2018
@krlmlr krlmlr closed this in e01bb7f Aug 13, 2018
@lock
Copy link

@lock lock bot commented Feb 9, 2019

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 Feb 9, 2019
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