knitr::opts_chunk$set(
  collapse = TRUE,
  cache = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

speedrunr

R-CMD-check CRAN status GitHub release GitHub last commit (master) No Maintenance Intended

The goal of speedrunr is to easily access data from speedrun.com.

Installation

You can install the released version of speedrunr from GitHub with:

pak::pak("jemus42/speedrunr")

Example

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

Identifiyng the game you're looking for

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.

Get the game's categories

categories <- get_categories(id = "j1l9qz1g")

categories %>%
  select(id, name, type) %>%
  head() %>%
  kable()

So apparently we're looking for q255jw2o, the full-game 100% category.

Get the runs in that 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()

More data

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:

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()

Code of Conduct

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.



jemus42/speedrunr documentation built on March 19, 2024, 2:35 p.m.