knitr::opts_chunk$set( collapse = TRUE, cache = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of speedrunr is to easily access data from speedrun.com.
You can install the released version of speedrunr from GitHub with:
pak::pak("jemus42/speedrunr")
Let's say you want to plot the times of all Ocarina of TIme 100% runs.
Let's get started:
library(speedrunr) library(dplyr) # Data manip library(knitr) # Tables
You can either search for "Ocarina of Time", or supply 'oot'
, the game's abbreviation on speedrun.com.
games <- get_games(name = "Ocarina of Time") games %>% select(id, name_international, name_abbr) %>% head() %>% kable()
Turns out j1l9qz1g
is the id we're looking for.
categories <- get_categories(id = "j1l9qz1g") categories %>% select(id, name, type) %>% head() %>% kable()
So apparently we're looking for q255jw2o
, the full-game 100% category.
Now we can fetch the runs. By default, 100 runs are returned, ordered by submit date in descending order, so newest runs first. This also means you will only be able to fully assess the WR progression if you make sure to get all the runs.
runs <- get_runs(game = "j1l9qz1g", category = "q255jw2o") glimpse(runs)
And now we can basically re-create the leaderboard, but including obsoleted runs:
library(hms) runs %>% arrange(time_primary) %>% head(20) %>% select(submitted, time_primary, player_name) %>% mutate(time_primary = hms(seconds = time_primary)) %>% kable()
Wanna resolve those platforms? Just join with this table:
get_platforms() %>% head() %>% kable()
Same can be done with regions:
get_regions() %>% kable()
There are also convenience functions to pipe your runs
object into:
add_platforms()
add_regions()
add_players()
, which only makes on API call per unique player.All of them work in the following way:
runs %>% add_regions() %>% add_platforms() %>% select(time_primary, system_region, system_platform) %>% sample_n(5) %>% knitr::kable()
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.