FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

as_tibble.data.table() method? · Issue #5698 · Rdatatable/data.table · GitHub

as_tibble.data.table() method?  #5698

Description

(I originally requested this at tidyverse/tibble/issues/1555, but they suggested requesting here instead.)

Would you consider adding a data.table method to as_tibble()? On extremely cursory testing, it may be as simple as adapting as_tibble.data.frame() with an extra line to remove the .internal.selfref attribute:

library(tibble)
library(data.table)
data(mpg, package = "ggplot2")

# two identical tibbles
mpg2 <- copy(mpg)
identical(mpg, mpg2)
#> [1] TRUE

# after converting to data.table and back to tibble, no longer identical
setDT(mpg2)
mpg2 <- as_tibble(mpg2)
identical(mpg, mpg2)
#> [1] FALSE

# identical again after removing ".internal.selfref" attribute
attr(mpg2, ".internal.selfref") <- NULL
identical(mpg, mpg2)
#> [1] TRUE

Created on 2023-09-22 with reprex v2.0.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL