dm_unwrap_tbl()
unwraps all tables in a dm object so that the resulting dm
matches a given ptype dm.
It runs a sequence of dm_unnest_tbl()
and dm_unpack_tbl()
operations
on the dm.
Examples
roundtrip <-
dm_nycflights13() %>%
dm_wrap_tbl(root = flights) %>%
dm_unwrap_tbl(ptype = dm_ptype(dm_nycflights13()))
roundtrip
#> ── Metadata ────────────────────────────────────────────────────────────────────
#> Tables: `flights`, `airlines`, `airports`, `planes`, `weather`
#> Columns: 53
#> Primary keys: 4
#> Foreign keys: 4
# The roundtrip has the same structure but fewer rows:
dm_nrow(dm_nycflights13())
#> airlines airports flights planes weather
#> 15 86 1761 945 144
dm_nrow(roundtrip)
#> flights airlines airports planes weather
#> 1761 15 3 1112 105