-
Notifications
You must be signed in to change notification settings - Fork 131
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
as_tibble.data.frame() treats attr()-type attributes inconsistently: sripts "n" but not others. #1573
Comments
It seems dropping attributes was an ongoing discussion last year (see #769 ) 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
The text was updated successfully, but these errors were encountered: