Skip to contents

Basic

Construct a dm object from data frames, see also vignette("howto-dm-df").

dm() new_dm() is_dm() as_dm()
Data model class
dm_validate()
Validator

Database

Construct a dm object from a database, see also vignette("howto-dm-db").

dm_from_con()
Load a dm from a remote data source
dm_get_con()
Get connection

Tables and columns

Operate on the tables and columns stored in a dm object.

dm_select_tbl() dm_rename_tbl()
Select and rename tables
dm_get_tables()
Get tables
pull_tbl()
Retrieve a table
dm_mutate_tbl() experimental
Update tables in a dm
dm_nrow()
Number of rows
dm_select()
Select columns
dm_rename()
Rename columns

Primary keys

Primary keys uniquely identify rows in a table. A table can have at most one primary key. See also vignette("howto-dm-theory").

dm_add_pk()
Add a primary key
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

Unique keys are similar to primary keys. Each table can have at most one record for each combination of values in a unique key. A table can have more than one unique key.

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

Foreign keys establish links between tables by pointing to a primary or unique key in another table. See also vignette("howto-dm-theory").

dm_add_fk()
Add foreign keys
dm_get_all_fks()
Get foreign key constraints
dm_rm_fk()
Remove foreign keys

Visualize

Show a dm object, see also vignette("tech-dm-draw").

dm_gui() experimental
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_set_table_description() dm_get_table_description() dm_reset_table_description()
Add info about a dm's tables

Deconstruct

Rip a dm object apart and put it together, see also vignette("tech-dm-keyed").

dm_deconstruct() experimental
Create code to deconstruct a dm object

Flatten

Combine multiple related tables, see also vignette("tech-dm-join").

dm_flatten() experimental
Flatten a table in a dm by joining its parent tables
dm_flatten_to_tbl()
Flatten a part of a dm into a wide table
dm_disambiguate_cols()
Resolve column name ambiguities

Filter

Filter across multiple tables, see also vignette("tech-dm-filter").

dm_filter()
Filtering

Zoom

Focus on a single table, see also vignette("tech-dm-zoom").

dm_zoom_to() dm_insert_zoomed() dm_update_zoomed() dm_discard_zoomed()
Mark table for manipulation
left_join(<dm_zoomed>) left_join(<dm_keyed_tbl>) inner_join(<dm_zoomed>) inner_join(<dm_keyed_tbl>) full_join(<dm_zoomed>) full_join(<dm_keyed_tbl>) right_join(<dm_zoomed>) right_join(<dm_keyed_tbl>) semi_join(<dm_zoomed>) semi_join(<dm_keyed_tbl>) anti_join(<dm_zoomed>) anti_join(<dm_keyed_tbl>) nest_join(<dm_zoomed>) cross_join(<dm_zoomed>) cross_join(<dm_keyed_tbl>)
dplyr join methods for zoomed dm objects
filter(<dm_zoomed>) filter(<dm_keyed_tbl>) filter_out(<dm_zoomed>) filter_out(<dm_keyed_tbl>) mutate(<dm_zoomed>) mutate(<dm_keyed_tbl>) transmute(<dm_zoomed>) transmute(<dm_keyed_tbl>) select(<dm_zoomed>) select(<dm_keyed_tbl>) relocate(<dm_zoomed>) relocate(<dm_keyed_tbl>) rename(<dm_zoomed>) rename(<dm_keyed_tbl>) distinct(<dm_zoomed>) distinct(<dm_keyed_tbl>) arrange(<dm_zoomed>) arrange(<dm_keyed_tbl>) slice(<dm_zoomed>) slice(<dm_keyed_tbl>) group_by(<dm_zoomed>) group_by(<dm_keyed_tbl>) ungroup(<dm_zoomed>) ungroup(<dm_keyed_tbl>) summarise(<dm_zoomed>) summarise(<dm_keyed_tbl>) reframe(<dm_zoomed>) reframe(<dm_keyed_tbl>) count(<dm_zoomed>) count(<dm_keyed_tbl>) tally(<dm_zoomed>) tally(<dm_keyed_tbl>) pull(<dm_zoomed>) compute(<dm_zoomed>)
dplyr table manipulation methods for zoomed dm objects
glimpse(<dm>) glimpse(<dm_zoomed>)
Get a glimpse of your dm object
unite(<dm_zoomed>) unite(<dm_keyed_tbl>) separate(<dm_zoomed>) separate(<dm_keyed_tbl>)
tidyr table manipulation methods for zoomed dm objects
head(<dm_zoomed>) tail(<dm_zoomed>)
utils table manipulation methods for dm_zoomed objects

Wrap

Turn a dm object into a single table and back.

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

Nested and packed data

New verbs that power wrapping.

pack_join() experimental
Pack Join
json_nest() experimental
JSON nest
json_nest_join() experimental
JSON nest join
json_pack() experimental
JSON pack
json_pack_join() experimental
JSON pack join
json_unnest()
Unnest a JSON column
json_unpack()
Unpack a JSON column

Materialize and upload

Get data from and to the database, see also vignette("howto-dm-copy").

compute(<dm>) collect(<dm>)
Materialize
copy_dm_to()
Copy data model to data source
dm_sql() dm_ddl_pre() dm_dml_load() dm_ddl_post() experimental
Create DDL and DML scripts for a dm a and database connection

Modify

Manipulate individual rows on the database, see also vignette("howto-dm-rows").

Keys and cardinalities

Check fulfillment and nature of relationships between tables.

dm_examine_constraints()
Validate your data model
enum_pk_candidates() dm_enum_pk_candidates() experimental
Primary key candidate
dm_enum_fk_candidates() enum_fk_candidates() experimental
Foreign key candidates
dm_examine_cardinalities() experimental
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
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

Table surgery

Normalize and denormalize tables.

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

Database schemas

New verbs that power access to database schemas.

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

Example dm objects

Ready to use and play with.

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

Structure and contents

Recreate a dm object.

dm_paste()
Create R code for a dm object
dm_ptype()
Prototype for a dm object