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.
Arguments
- dm
A dm.
- ptype
A dm, only used to query names of primary and foreign keys.
- progress
Whether to display a progress bar, if
NA
(the default) hide in non-interactive mode, show in interactive mode. Requires the 'progress' package.
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