Closed krivit closed 6 months ago
It seems dropping attributes was an ongoing discussion last year (see #769 ) I also just experienced a problem with remnant attributes after conversion to tibble that breaks some automated testing utilities. For instance converting back and forth a tibble to data.table breaks equality using testthat:
test_df = tibble(a = c(1,2,3))
converted_df = a %>% data.table::as.data.table() %>% tibble::as_tibble()
testthat::expect_equal(test_df, converted_df)
# Error: `test_df` (`actual`) not equal to `converted_df` (`expected`).
# `attr(actual, '.internal.selfref')` is absent
# `attr(expected, '.internal.selfref')` is a pointer
due to the '.internal.selfref' data.table attribute. I would tend to think this is an undesirable behavior.
Thanks. The discussion in #769 is unrelated, the original issue is a genuine bug. Running revdepchecks and releasing to CRAN.
as_tibble.data.frame()
appears to strip some custom attributes. So far, I've only noticed this forn
, but there may be others. I think it should either strip all the non-standard attributes or preserve them all, and document the behaviour either way.Created on 2024-04-02 with reprex v2.1.0