Import Data

library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.1     ✔ purrr   1.0.1
## ✔ tibble  3.1.8     ✔ dplyr   1.1.0
## ✔ tidyr   1.3.0     ✔ stringr 1.5.0
## ✔ readr   2.1.4     ✔ forcats 1.0.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
ratings <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-01-25/ratings.csv')
## Rows: 21831 Columns: 10
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (3): name, url, thumbnail
## dbl (7): num, id, year, rank, average, bayes_average, users_rated
## 
## ℹ 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.
details <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2022/2022-01-25/details.csv')
## Rows: 21631 Columns: 23
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (10): primary, description, boardgamecategory, boardgamemechanic, boardg...
## dbl (13): num, id, yearpublished, minplayers, maxplayers, playingtime, minpl...
## 
## ℹ 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.
ratings %>% count(id)
## # A tibble: 21,831 × 2
##       id     n
##    <dbl> <int>
##  1     1     1
##  2     2     1
##  3     3     1
##  4     4     1
##  5     5     1
##  6     6     1
##  7     7     1
##  8     8     1
##  9     9     1
## 10    10     1
## # … with 21,821 more rows
details %>% count(id)
## # A tibble: 21,631 × 2
##       id     n
##    <dbl> <int>
##  1     1     1
##  2     2     1
##  3     3     1
##  4     4     1
##  5     5     1
##  6     6     1
##  7     7     1
##  8     8     1
##  9     9     1
## 10    10     1
## # … with 21,621 more rows

left_join

left_join(ratings, details, by = "id")
## # A tibble: 21,831 × 32
##    num.x     id name      year  rank average bayes…¹ users…² url   thumb…³ num.y
##    <dbl>  <dbl> <chr>    <dbl> <dbl>   <dbl>   <dbl>   <dbl> <chr> <chr>   <dbl>
##  1   105  30549 Pandemic  2008   106    7.59    7.49  108975 /boa… https:…     0
##  2   189    822 Carcass…  2000   190    7.42    7.31  108738 /boa… https:…     1
##  3   428     13 Catan     1995   429    7.14    6.97  108024 /boa… https:…     2
##  4    72  68448 7 Wonde…  2010    73    7.74    7.63   89982 /boa… https:…     3
##  5   103  36218 Dominion  2008   104    7.61    7.50   81561 /boa… https:…     4
##  6   191   9209 Ticket …  2004   192    7.41    7.30   76171 /boa… https:…     5
##  7   100 178900 Codenam…  2015   101    7.6     7.51   74419 /boa… https:…     6
##  8     3 167791 Terrafo…  2016     4    8.42    8.27   74216 /boa… https:…     7
##  9    15 173346 7 Wonde…  2015    16    8.11    7.98   69472 /boa… https:…     8
## 10    35  31260 Agricola  2007    36    7.93    7.81   66093 /boa… https:…     9
## # … with 21,821 more rows, 21 more variables: primary <chr>, description <chr>,
## #   yearpublished <dbl>, minplayers <dbl>, maxplayers <dbl>, playingtime <dbl>,
## #   minplaytime <dbl>, maxplaytime <dbl>, minage <dbl>,
## #   boardgamecategory <chr>, boardgamemechanic <chr>, boardgamefamily <chr>,
## #   boardgameexpansion <chr>, boardgameimplementation <chr>,
## #   boardgamedesigner <chr>, boardgameartist <chr>, boardgamepublisher <chr>,
## #   owned <dbl>, trading <dbl>, wanting <dbl>, wishing <dbl>, and abbreviated …
left_join(details, ratings, by = "id")
## # A tibble: 21,631 × 32
##    num.x     id primary  descr…¹ yearp…² minpl…³ maxpl…⁴ playi…⁵ minpl…⁶ maxpl…⁷
##    <dbl>  <dbl> <chr>    <chr>     <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
##  1     0  30549 Pandemic In Pan…    2008       2       4      45      45      45
##  2     1    822 Carcass… Carcas…    2000       2       5      45      30      45
##  3     2     13 Catan    In CAT…    1995       3       4     120      60     120
##  4     3  68448 7 Wonde… You ar…    2010       2       7      30      30      30
##  5     4  36218 Dominion &quot;…    2008       2       4      30      30      30
##  6     5   9209 Ticket … With e…    2004       2       5      60      30      60
##  7     6 178900 Codenam… Codena…    2015       2       8      15      15      15
##  8     7 167791 Terrafo… In the…    2016       1       5     120     120     120
##  9     8 173346 7 Wonde… In man…    2015       2       2      30      30      30
## 10     9  31260 Agricola Descri…    2007       1       5     150      30     150
## # … with 21,621 more rows, 22 more variables: minage <dbl>,
## #   boardgamecategory <chr>, boardgamemechanic <chr>, boardgamefamily <chr>,
## #   boardgameexpansion <chr>, boardgameimplementation <chr>,
## #   boardgamedesigner <chr>, boardgameartist <chr>, boardgamepublisher <chr>,
## #   owned <dbl>, trading <dbl>, wanting <dbl>, wishing <dbl>, num.y <dbl>,
## #   name <chr>, year <dbl>, rank <dbl>, average <dbl>, bayes_average <dbl>,
## #   users_rated <dbl>, url <chr>, thumbnail <chr>, and abbreviated variable …