Learn R Programming

dm (version 0.0.4)

cdm_zoom_to_tbl: Single out a table of a dm

Description

Zooming to a table of a dm allows for the use of many dplyr-verbs directly on this table, while retaining the context of the dm object.

Usage

cdm_zoom_to_tbl(dm, table)

cdm_insert_zoomed_tbl(dm, new_tbl_name)

cdm_update_zoomed_tbl(dm)

cdm_zoom_out(dm)

Arguments

dm

A dm object.

table

A table in the dm

new_tbl_name

Name of the new table

Details

cdm_zoom_to_tbl(): zooms to the given table

cdm_update_zoomed_tbl(): overwrites the originally zoomed table with the manipulated table. The filter conditions for the zoomed table are added to the original filter conditions.

cdm_insert_zoomed_tbl(): adds a new table to the dm.

cdm_zoom_out(): discards the zoomed table, returning the dm from before zooming

Whenever possible, the key relations of the original table are transferred to the resulting table when using cdm_insert_zoomed_tbl() or cdm_update_zoomed_tbl().

Functions from dplyr, that are supported for a zoomed_dm: group_by(), summarise(), mutate(), transmute(), select(), rename() and ungroup(). You can use these functions just like you would with a normal table.

filter() is also supported, but treated in a special way: the filter expression for the zoomed table is stored in the dm and is treated depending on which function you use to return to a normal dm:

  1. cdm_zoom_out(): all filter conditions for the zoomed table are discarded

  2. cdm_update_zoomed_tbl(): the filter conditions of the original table and those of the zoomed table are combined

  3. cdm_insert_zoomed_tbl(): the filter conditions of the original table stay there and those of the zoomed table are transferred to the new table of the dm