Learn R Programming

dm (version 0.0.6.9000)

dm_paste: Reverse engineer code for creation of a dm

Description

dm_paste takes an existing dm and produces the code necessary for its creation

Usage

dm_paste(dm, select = FALSE, tab_width = 2)

Arguments

dm

A dm object.

select

Boolean, default FALSE. If TRUE will try to produce code for reducing to necessary columns.

tab_width

Indentation width for code from the second line onwards

Value

Code for producing the given dm.

Details

At the very least (if no keys exist in the given dm) a dm() statement is produced that -- when executed -- produces the same dm. In addition, the code for setting the existing primary keys as well as the relations between the tables is produced. If select = TRUE, statements are included to select the respective columns of each table of the dm (useful if only a subset of the columns of the original tables is used for the dm).

Mind, that it is assumed, that the tables of the existing dm are available in the global environment under their names within the dm.