Skip to contents

Basic

dm() new_dm() is_dm() as_dm()
Data model class
dm_from_con()
Load a dm from a remote data source
dm_get_con()
Get connection

Tables

Primary keys

dm_add_pk()
Add a primary key
enum_pk_candidates() dm_enum_pk_candidates()
Primary key candidate
dm_get_all_pks()
Get all primary keys of a dm object
dm_has_pk()
Check for primary key
dm_rm_pk()
Remove a primary key

Unique keys

dm_add_uk()
Add a unique key
dm_get_all_uks()
Get all unique keys of a dm object
dm_rm_uk()
Remove a unique key

Foreign keys

dm_add_fk()
Add foreign keys
dm_enum_fk_candidates() enum_fk_candidates()
Foreign key candidates
dm_get_all_fks()
Get foreign key constraints
dm_rm_fk()
Remove foreign keys

Visualize

dm_gui()
Shiny app for defining dm objects
dm_draw()
Draw a diagram of the data model
dm_set_colors() dm_get_colors() dm_get_available_colors()
Color in database diagrams
dm_paste()
Create R code for a dm object

Select columns

dm_select()
Select columns
dm_rename()
Rename columns

Flatten

dm_flatten_to_tbl()
Flatten a part of a dm into a wide table
dm_disambiguate_cols()
Resolve column name ambiguities

Filter

dm_filter()
Filtering

Zoom

Wrap

dm_wrap_tbl()
Wrap dm into a single tibble dm
dm_unwrap_tbl()
Unwrap a single table dm
dm_nest_tbl()
Nest a table inside its dm
dm_pack_tbl()
dm_pack_tbl()
dm_unnest_tbl()
Unnest columns from a wrapped table
dm_unpack_tbl()
Unpack columns from a wrapped table

Operations on data frames and lazy tables

pack_join()
Pack Join
json_nest()
JSON nest
json_nest_join()
JSON nest join
json_pack()
JSON pack
json_pack_join()
JSON pack join

Materialize

Upload

copy_dm_to()
Copy data model to data source
dm_rows_insert() dm_rows_append() dm_rows_update() dm_rows_patch() dm_rows_upsert() dm_rows_delete()
Modifying rows for multiple tables

Table surgery

decompose_table()
Decompose a table into two linked tables
reunite_parent_child() reunite_parent_child_from_list()
Merge two tables that are linked by a foreign key relation

Check keys and cardinalities

dm_examine_cardinalities()
Learn about your data model
check_cardinality_0_n() check_cardinality_1_n() check_cardinality_1_1() check_cardinality_0_1() examine_cardinality()
Check table relations
dm_examine_constraints()
Validate your data model
check_key()
Check if column(s) can be used as keys
check_set_equality()
Check column values for set equality
check_subset()
Check column values for subset

Database schemas

db_schema_create()
Create a schema on a database
db_schema_drop()
Remove a schema from a database
db_schema_exists()
Check for existence of a schema on a database
db_schema_list()
List schemas on a database

Example dm objects

dm_nycflights13()
Creates a dm object for the nycflights13 data
dm_financial() dm_financial_sqlite()
Creates a dm object for the Financial data
dm_pixarfilms()
Creates a dm object for the pixarfilms data

Miscellaneous

dm_nrow()
Number of rows
dm_ptype()
Prototype for a dm object
dm_validate()
Validator