According to the documentation, select() should preserve attributes ("Data frame attributes are preserved." in section Value). However, this seems to work only for tibbles, not for data frames. This is an reproducible example:
mtcars_df <- mtcars
attr(mtcars_df, "test") <- TRUE
mtcars_tib <- as_tibble(mtcars_df)
attr(mtcars_df, "test")
attr(mtcars_tib, "test")
attr(dplyr::select(mtcars_df), "test")
attr(dplyr::select(mtcars_tib), "test")
With dplyr 0.8.5, all the four calls of attr() return TRUE as expected. But with dplyr 1.0.0, attr(dplyr::select(mtcars_df), "test") returns NULL.
The result does not change, if some columns are selected.
According to the documentation,
select()should preserve attributes ("Data frame attributes are preserved." in section Value). However, this seems to work only for tibbles, not for data frames. This is an reproducible example:With dplyr 0.8.5, all the four calls of
attr()returnTRUEas expected. But with dplyr 1.0.0,attr(dplyr::select(mtcars_df), "test")returnsNULL.The result does not change, if some columns are selected.