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

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

Closed
thomasalcock opened this issue Jul 4, 2022 · 0 comments · Fixed by #6344
Closed

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

thomasalcock opened this issue Jul 4, 2022 · 0 comments · Fixed by #6344
Labels
bug an unexpected problem or unintended behavior verbs 🏃‍♀️

Comments

@thomasalcock
Copy link

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior verbs 🏃‍♀️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants