Import two related datasets from TidyTuesday Project.
pixar_films <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2025/2025-03-11/pixar_films.csv')
## Rows: 27 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): film, film_rating
## dbl (2): number, run_time
## date (1): release_date
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
public_response <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2025/2025-03-11/public_response.csv')
## Rows: 24 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): film, cinema_score
## dbl (3): rotten_tomatoes, metacritic, critics_choice
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Describe the two datasets:
Data1: Pixar Films
Data 2: Public Response
set.seed(1234)
pixar_films_small <- pixar_films %>%
select(film,release_date,run_time) %>%
sample_n(10)
public_response_small <- public_response %>%
select(film, rotten_tomatoes, cinema_score) %>%
sample_n(10)
pixar_films_small
## # A tibble: 10 × 3
## film release_date run_time
## <chr> <date> <dbl>
## 1 The Good Dinosaur 2015-11-25 93
## 2 Lightyear 2022-06-17 NA
## 3 Onward 2020-03-06 102
## 4 Finding Nemo 2003-05-30 100
## 5 Cars 2 2011-06-24 106
## 6 Inside Out 2015-06-19 95
## 7 WALL-E 2008-06-27 98
## 8 Luca 2021-06-18 151
## 9 The Incredibles 2004-11-05 115
## 10 <NA> 2023-06-16 155
public_response_small
## # A tibble: 10 × 3
## film rotten_tomatoes cinema_score
## <chr> <dbl> <chr>
## 1 Monsters, Inc. 96 A+
## 2 A Bug's Life 92 A
## 3 Cars 74 A
## 4 The Incredibles 97 A+
## 5 Inside Out 98 A
## 6 Monsters University 80 A
## 7 Coco 97 A+
## 8 Luca NA <NA>
## 9 Finding Dory 94 A
## 10 Finding Nemo 99 A+
Describe the resulting data:
How is it different from the original two datasets?
pixar_films_small %>% inner_join(public_response_small, by = c("film"))
## # A tibble: 4 × 5
## film release_date run_time rotten_tomatoes cinema_score
## <chr> <date> <dbl> <dbl> <chr>
## 1 Finding Nemo 2003-05-30 100 99 A+
## 2 Inside Out 2015-06-19 95 98 A
## 3 Luca 2021-06-18 151 NA <NA>
## 4 The Incredibles 2004-11-05 115 97 A+
Describe the resulting data:
How is it different from the original two datasets?
The left join keeps all 10 rows from Pixar films datasets and adds the matching information from public responses dataset.
pixar_films_small %>%
left_join(public_response_small, by =c("film"))
## # A tibble: 10 × 5
## film release_date run_time rotten_tomatoes cinema_score
## <chr> <date> <dbl> <dbl> <chr>
## 1 The Good Dinosaur 2015-11-25 93 NA <NA>
## 2 Lightyear 2022-06-17 NA NA <NA>
## 3 Onward 2020-03-06 102 NA <NA>
## 4 Finding Nemo 2003-05-30 100 99 A+
## 5 Cars 2 2011-06-24 106 NA <NA>
## 6 Inside Out 2015-06-19 95 98 A
## 7 WALL-E 2008-06-27 98 NA <NA>
## 8 Luca 2021-06-18 151 NA <NA>
## 9 The Incredibles 2004-11-05 115 97 A+
## 10 <NA> 2023-06-16 155 NA <NA>
Describe the resulting data:
How is it different from the original two datasets?
The right join keeps all 10 rows from the Public Response dataset and adds the matching information from the Pixar films dataset.
pixar_films_small %>%
right_join(public_response_small, by =c("film"))
## # A tibble: 10 × 5
## film release_date run_time rotten_tomatoes cinema_score
## <chr> <date> <dbl> <dbl> <chr>
## 1 Finding Nemo 2003-05-30 100 99 A+
## 2 Inside Out 2015-06-19 95 98 A
## 3 Luca 2021-06-18 151 NA <NA>
## 4 The Incredibles 2004-11-05 115 97 A+
## 5 Monsters, Inc. NA NA 96 A+
## 6 A Bug's Life NA NA 92 A
## 7 Cars NA NA 74 A
## 8 Monsters University NA NA 80 A
## 9 Coco NA NA 97 A+
## 10 Finding Dory NA NA 94 A
Describe the resulting data:
How is it different from the original two datasets?
The full join keeps all rows from both Pixar films and Public Response datasets. It combines the information when films match and shows NA when a film does not appear in one of the datasets.
pixar_films_small %>%
full_join(public_response_small, by =c("film"))
## # A tibble: 16 × 5
## film release_date run_time rotten_tomatoes cinema_score
## <chr> <date> <dbl> <dbl> <chr>
## 1 The Good Dinosaur 2015-11-25 93 NA <NA>
## 2 Lightyear 2022-06-17 NA NA <NA>
## 3 Onward 2020-03-06 102 NA <NA>
## 4 Finding Nemo 2003-05-30 100 99 A+
## 5 Cars 2 2011-06-24 106 NA <NA>
## 6 Inside Out 2015-06-19 95 98 A
## 7 WALL-E 2008-06-27 98 NA <NA>
## 8 Luca 2021-06-18 151 NA <NA>
## 9 The Incredibles 2004-11-05 115 97 A+
## 10 <NA> 2023-06-16 155 NA <NA>
## 11 Monsters, Inc. NA NA 96 A+
## 12 A Bug's Life NA NA 92 A
## 13 Cars NA NA 74 A
## 14 Monsters University NA NA 80 A
## 15 Coco NA NA 97 A+
## 16 Finding Dory NA NA 94 A
Describe the resulting data:
How is it different from the original two datasets?
The semi join keeps only the films from the first dataset Pixar Films that also appear in the second dataset Public Response.
pixar_films_small %>%
semi_join(public_response_small, by =c("film"))
## # A tibble: 4 × 3
## film release_date run_time
## <chr> <date> <dbl>
## 1 Finding Nemo 2003-05-30 100
## 2 Inside Out 2015-06-19 95
## 3 Luca 2021-06-18 151
## 4 The Incredibles 2004-11-05 115
Describe the resulting data:
How is it different from the original two datasets?
The anti join keeps only the films from the first dataset Pixar Films that do not appear in the second dataset Public Response.
pixar_films_small %>%
anti_join(public_response_small, by = c("film"))
## # A tibble: 6 × 3
## film release_date run_time
## <chr> <date> <dbl>
## 1 The Good Dinosaur 2015-11-25 93
## 2 Lightyear 2022-06-17 NA
## 3 Onward 2020-03-06 102
## 4 Cars 2 2011-06-24 106
## 5 WALL-E 2008-06-27 98
## 6 <NA> 2023-06-16 155