dat <- tt_load('2024-10-01')$chess
glimpse(dat)
#> Rows: 20,058
#> Columns: 16
#> $ game_id <chr> "TZJHLljE", "l1NXvwaE", "mIICvQHh", "kWKvrqYL", "9tXo1A…
#> $ rated <lgl> FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE…
#> $ start_time <dbl> 1.50421e+12, 1.50413e+12, 1.50413e+12, 1.50411e+12, 1.5…
#> $ end_time <dbl> 1.50421e+12, 1.50413e+12, 1.50413e+12, 1.50411e+12, 1.5…
#> $ turns <dbl> 13, 16, 61, 61, 95, 5, 33, 9, 66, 119, 39, 38, 60, 31, …
#> $ victory_status <chr> "outoftime", "resign", "mate", "mate", "mate", "draw", …
#> $ winner <chr> "white", "black", "white", "white", "white", "draw", "w…
#> $ time_increment <chr> "15+2", "5+10", "5+10", "20+0", "30+3", "10+0", "10+0",…
#> $ white_id <chr> "bourgris", "a-00", "ischia", "daniamurashov", "nik2211…
#> $ white_rating <dbl> 1500, 1322, 1496, 1439, 1523, 1250, 1520, 1413, 1439, 1…
#> $ black_id <chr> "a-00", "skinnerua", "a-00", "adivanov2009", "adivanov2…
#> $ black_rating <dbl> 1191, 1261, 1500, 1454, 1469, 1002, 1423, 2108, 1392, 1…
#> $ moves <chr> "d4 d5 c4 c6 cxd5 e6 dxe6 fxe6 Nf3 Bb4+ Nc3 Ba5 Bf4", "…
#> $ opening_eco <chr> "D10", "B00", "C20", "D02", "C41", "B27", "D00", "B00",…
#> $ opening_name <chr> "Slav Defense: Exchange Variation", "Nimzowitsch Defens…
#> $ opening_ply <dbl> 5, 4, 3, 3, 5, 4, 10, 5, 6, 4, 1, 9, 3, 2, 8, 7, 8, 8, …
Create a summary of the frequency of the openings:
sumDat <- dat |>
count(opening_name) |>
arrange(n) |>
mutate(opening_name = fct_inorder(opening_name))
Create a plot of the top 20 most frequent openings:
p <- sumDat |>
tail(20) |>
ggplot(aes(opening_name, n)) +
geom_col(fill = "firebrick3") +
theme_minimal() +
labs(
x = "Opening name",
y = "Frequency",
title = "Top 20 most frequent openings (Lichess)"
) +
coord_flip()
p
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.4.1 (2024-06-14)
#> os Ubuntu 22.04.5 LTS
#> system x86_64, linux-gnu
#> ui X11
#> language en
#> collate C.UTF-8
#> ctype C.UTF-8
#> tz UTC
#> date 2024-09-19
#> pandoc 3.1.11 @ /opt/hostedtoolcache/pandoc/3.1.11/x64/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> bit 4.0.5 2022-11-15 [1] RSPM
#> bit64 4.0.5 2020-08-30 [1] RSPM
#> bslib 0.8.0 2024-07-29 [1] RSPM
#> cachem 1.1.0 2024-05-16 [1] RSPM
#> cli 3.6.3 2024-06-21 [1] RSPM
#> colorspace 2.1-1 2024-07-26 [1] RSPM
#> crayon 1.5.3 2024-06-20 [1] RSPM
#> curl 5.2.2 2024-08-26 [1] RSPM
#> desc 1.4.3 2023-12-10 [1] RSPM
#> digest 0.6.37 2024-08-19 [1] RSPM
#> dplyr * 1.1.4 2023-11-17 [1] RSPM
#> evaluate 1.0.0 2024-09-17 [1] RSPM
#> fansi 1.0.6 2023-12-08 [1] RSPM
#> farver 2.1.2 2024-05-13 [1] RSPM
#> fastmap 1.2.0 2024-05-15 [1] RSPM
#> forcats * 1.0.0 2023-01-29 [1] RSPM
#> fs 1.6.4 2024-04-25 [1] RSPM
#> generics 0.1.3 2022-07-05 [1] RSPM
#> ggplot2 * 3.5.1 2024-04-23 [1] RSPM
#> gh 1.4.1 2024-03-28 [1] RSPM
#> gitcreds 0.1.2 2022-09-08 [1] RSPM
#> glue 1.7.0 2024-01-09 [1] RSPM
#> gtable 0.3.5 2024-04-22 [1] RSPM
#> highr 0.11 2024-05-26 [1] RSPM
#> hms 1.1.3 2023-03-21 [1] RSPM
#> htmltools 0.5.8.1 2024-04-04 [1] RSPM
#> httr2 1.0.4 2024-09-13 [1] RSPM
#> jquerylib 0.1.4 2021-04-26 [1] RSPM
#> jsonlite 1.8.8 2023-12-04 [1] RSPM
#> knitr 1.48 2024-07-07 [1] RSPM
#> labeling 0.4.3 2023-08-29 [1] RSPM
#> lifecycle 1.0.4 2023-11-07 [1] RSPM
#> lubridate 1.9.3 2023-09-27 [1] RSPM
#> magrittr 2.0.3 2022-03-30 [1] RSPM
#> munsell 0.5.1 2024-04-01 [1] RSPM
#> pillar 1.9.0 2023-03-22 [1] RSPM
#> pkgconfig 2.0.3 2019-09-22 [1] RSPM
#> pkgdown 2.1.1 2024-09-17 [1] any (@2.1.1)
#> purrr 1.0.2 2023-08-10 [1] RSPM
#> R6 2.5.1 2021-08-19 [1] RSPM
#> ragg 1.3.3 2024-09-11 [1] RSPM
#> rappdirs 0.3.3 2021-01-31 [1] RSPM
#> readr 2.1.5 2024-01-10 [1] RSPM
#> rlang 1.1.4 2024-06-04 [1] RSPM
#> rmarkdown 2.28 2024-08-17 [1] RSPM
#> sass 0.4.9 2024-03-15 [1] RSPM
#> scales 1.3.0 2023-11-28 [1] RSPM
#> sessioninfo 1.2.2 2021-12-06 [1] RSPM
#> systemfonts 1.1.0 2024-05-15 [1] RSPM
#> textshaping 0.4.0 2024-05-24 [1] RSPM
#> tibble 3.2.1 2023-03-20 [1] RSPM
#> tidyr 1.3.1 2024-01-24 [1] RSPM
#> tidyselect 1.2.1 2024-03-11 [1] RSPM
#> tidytuesdayR * 1.1.2 2024-09-09 [1] RSPM
#> timechange 0.3.0 2024-01-18 [1] RSPM
#> tzdb 0.4.0 2023-05-12 [1] RSPM
#> utf8 1.2.4 2023-10-22 [1] RSPM
#> vctrs 0.6.5 2023-12-01 [1] RSPM
#> vroom 1.6.5 2023-12-05 [1] RSPM
#> withr 3.0.1 2024-07-31 [1] RSPM
#> xfun 0.47 2024-08-17 [1] RSPM
#> xml2 1.3.6 2023-12-04 [1] RSPM
#> yaml 2.3.10 2024-07-26 [1] RSPM
#>
#> [1] /home/runner/work/_temp/Library
#> [2] /opt/R/4.4.1/lib/R/site-library
#> [3] /opt/R/4.4.1/lib/R/library
#>
#> ──────────────────────────────────────────────────────────────────────────────