View source: R/dm_deconstruct.R
dm_deconstruct | R Documentation |
Emits code that assigns each table in the dm to a variable,
using pull_tbl()
with keyed = TRUE
.
These tables retain information about primary and foreign keys,
even after data transformations,
and can be converted back to a dm object with dm()
.
dm_deconstruct(dm, dm_name = NULL)
dm |
A |
dm_name |
The code to use to access the dm object, by default the expression passed to this function. |
This function is called for its side effect of printing generated code.
dm <- dm_nycflights13()
dm_deconstruct(dm)
airlines <- pull_tbl(dm, "airlines", keyed = TRUE)
airports <- pull_tbl(dm, "airports", keyed = TRUE)
flights <- pull_tbl(dm, "flights", keyed = TRUE)
planes <- pull_tbl(dm, "planes", keyed = TRUE)
weather <- pull_tbl(dm, "weather", keyed = TRUE)
by_origin <-
flights %>%
group_by(origin) %>%
summarize(mean_arr_delay = mean(arr_delay, na.rm = TRUE)) %>%
ungroup()
by_origin
dm(airlines, airports, flights, planes, weather, by_origin) %>%
dm_draw()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.