Git Product home page Git Product logo

Comments (4)

markfairbanks avatar markfairbanks commented on July 19, 2024 1

This one has a couple issues:

  1. The nested column contains tibbles, not data.tables. unnest.() currently works by saying "if not a nested data.table, treat the value as a nested vector."

That issue is pretty easily solvable.

  1. Solving that issue then runs into an issue where the columns are not the same order between the two tibbles.

I'm not sure how to solve that one yet! But I'll work on it. Hopefully I'll have a solution by tomorrow

from tidytable.

markfairbanks avatar markfairbanks commented on July 19, 2024 1

Yep that's a good callout. I didn't specify that in the new issue. I'll open another one

from tidytable.

markfairbanks avatar markfairbanks commented on July 19, 2024

I'm going to close this issue as I solved what this issue was originally about, but I'll open a new one regarding the second issue I mentioned above

from tidytable.

leungi avatar leungi commented on July 19, 2024

Thanks for quick fix 👍

Where can we put in a fill, similar to data.table::rbindlist(..., fill) to allow for extra columns (casted as NA by fill)?

library(tidytable)
library(dplyr)

dat <- structure(
  list(
    id = c("11", "22"),
    phase = c("a", "b"),
    values = list(
      structure(
        list(
          a = 1.54,
          b = 192,
          c = "50%"
        ),
        row.names = c(NA, -1L),
        class = c("tbl_df",
                  "tbl", "data.frame")
      ),
      structure(
        list(
          a = 0.5,
          b = 44,
          c = "100%",
          d = TRUE
        ),
        row.names = c(NA,
                      -1L),
        class = c("tbl_df", "tbl", "data.frame")
      )
    )
  ),
  row.names = c(NA,
                -2L),
  class = c("tbl_df", "tbl", "data.frame")
)


dat %>% 
  unnest.(values)
#> Error in `[.data.table`(.data, , unlist(values, recursive = FALSE), by = keep_cols) :
#>  j doesn't evaluate to the same number of columns for each group

# Expected
dat %>% tidyr::unnest(values)
# A tibble: 2 x 6
  id    phase     a     b c     d
  <chr> <chr> <dbl> <dbl> <chr> <lgl>
1 11    a      1.54   192 50%   NA
2 22    b      0.5     44 100%  TRUE

from tidytable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.