Skip to content

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

@markvanderloo

Description

@markvanderloo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions