Using pixarfilms with dm

Overview

The {pixarfilms} R package has been added to the {dm} R package, which is a package “for working with multiple related tables, stored as data frames or in a relational database.”

Because all of the tables created in {pixarfilms} are connected by each film, this gives an interesting opportunity to explore these interconnected tables together.

Setup

library(dm)
#> 
#> Attaching package: 'dm'
#> The following object is masked from 'package:stats':
#> 
#>     filter

Explore

dm <- dm_pixarfilms(consistent = TRUE)
dm
#> ── Metadata ────────────────────────────────────────────────────────────────────
#> Tables: `pixar_films`, `pixar_people`, `academy`, `box_office`, `genres`, `public_response`
#> Columns: 23
#> Primary keys: 5
#> Foreign keys: 5
dm %>%
  dm_examine_cardinalities()
#> • FK: pixar_people$(`film`) -> pixar_films$(`film`): surjective mapping (child: 1 to n -> parent: 1)
#> • FK: academy$(`film`) -> pixar_films$(`film`): generic mapping (child: 0 to n -> parent: 1)
#> • FK: box_office$(`film`) -> pixar_films$(`film`): injective mapping (child: 0 or 1 -> parent: 1)
#> • FK: genres$(`film`) -> pixar_films$(`film`): surjective mapping (child: 1 to n -> parent: 1)
#> • FK: public_response$(`film`) -> pixar_films$(`film`): injective mapping (child: 0 or 1 -> parent: 1)
dm %>%
  dm_examine_constraints()
#> ℹ All constraints satisfied.

Visualize connections

dm_pixarfilms() %>%
  dm_draw()