# NOT RUN {
flights_zoomed <- dm_zoom_to(dm_nycflights13(), flights)
flights_zoomed
flights_zoomed_transformed <-
flights_zoomed %>%
mutate(am_pm_dep = ifelse(dep_time < 1200, "am", "pm")) %>%
# `by`-argument of `left_join()` can be explicitly given
# otherwise the key-relation is used
left_join(airports) %>%
select(year:dep_time, am_pm_dep, everything())
flights_zoomed_transformed
# replace table `flights` with the zoomed table
flights_zoomed_transformed %>%
dm_update_zoomed()
# insert the zoomed table as a new table
flights_zoomed_transformed %>%
dm_insert_zoomed("extended_flights") %>%
dm_draw()
# discard the zoomed table
flights_zoomed_transformed %>%
dm_discard_zoomed()
# }
Run the code above in your browser using DataLab