Skip to content

distinct() does not preserve attributes for data.frame objects #6318

Closed
@thomasalcock

Description

@thomasalcock

According to the documentation distinct should preserve attributes for data.frame objects. Attributes are preserved for tibble objects, but not for data.frame objects. Package version: 1.0.7.

library(dplyr, warn.conflicts = FALSE)

df_noattr <- distinct(structure(iris, a="b"))
attr(df_noattr, "a", exact=TRUE)
# NULL

df_attr <- distinct(structure(as_tibble(iris), a="b"))
attr(df_attr, "a", exact=TRUE)
# "b"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorverbs 🏃‍♀️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions