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

map_df Loses Attributes #532

Closed
billdenney opened this issue Aug 12, 2018 · 2 comments
Closed

map_df Loses Attributes #532

billdenney opened this issue Aug 12, 2018 · 2 comments

Comments

@billdenney
Copy link

When running map_df() on a data.frame, all attributes of the columns are lost.

library(purrr)
#> Warning: package 'purrr' was built under R version 3.4.4
foo <- data.frame(A = 1, B = 2)
attr(foo$A, "hi") <- "hello"
bar <- map_df(.x = foo, .f = function(x) x)
attributes(foo$A)
#> $hi
#> [1] "hello"
attributes(bar$A)
#> NULL
@davidski
Copy link

Possible duplicate of #358?

@hadley
Copy link
Member

hadley commented Aug 22, 2018

Really a duplicate of tidyverse/dplyr#3259 — but in general you shouldn't expect attributes not associated with an S3 class to be preserved by any operation.

@hadley hadley closed this as completed Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants