dm_paste: Create R code for a dm object

View source: R/paste.R

dm_pasteR Documentation

Create R code for a dm object

Description

dm_paste() takes an existing dm and emits the code necessary for its creation.

Usage

dm_paste(dm, select = NULL, ..., tab_width = 2, options = NULL, path = NULL)

Arguments

dm

A dm object.

select

Deprecated, see "select" in the options argument.

...

Must be empty.

tab_width

Indentation width for code from the second line onwards

options

Formatting options. A character vector containing some of:

  • "tables": tibble() calls for empty table definitions derived from dm_ptype(), overrides "select".

  • "select": dm_select() statements for columns that are part of the dm.

  • "keys": dm_add_pk(), dm_add_fk() and dm_add_uk() statements for adding keys.

  • "color": dm_set_colors() statements to set color.

  • "all": All options above except "select"

Default NULL is equivalent to c("keys", "color")

path

Output file, if NULL the code is printed to the console.

Details

The code emitted by the function reproduces the structure of the dm object. The options argument controls the level of detail: keys, colors, table definitions. Data in the tables is never included, see dm_ptype() for the underlying logic.

Value

Code for producing the prototype of the given dm.

Examples

dm() %>%
  dm_paste()


dm_nycflights13() %>%
  dm_paste()

dm_nycflights13() %>%
  dm_paste(options = "select")


krlmlr/dm documentation built on April 19, 2024, 5:23 p.m.