Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jemus42/speedrunr
A speedrun.com API wrapper for R
https://github.com/jemus42/speedrunr
api-wrapper r-package rstats speedruncom
Last synced: 24 days ago
JSON representation
A speedrun.com API wrapper for R
- Host: GitHub
- URL: https://github.com/jemus42/speedrunr
- Owner: jemus42
- License: other
- Created: 2018-06-24T21:33:22.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-03-18T13:56:30.000Z (8 months ago)
- Last Synced: 2024-10-11T18:18:32.916Z (about 1 month ago)
- Topics: api-wrapper, r-package, rstats, speedruncom
- Language: R
- Homepage: https://jemus42.github.io/speedrunr/
- Size: 15.3 MB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Support: .github/SUPPORT.md
Awesome Lists containing this project
README
---
output: github_document
editor_options:
chunk_output_type: console
---```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
cache = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# speedrunr
[![R-CMD-check](https://github.com/jemus42/speedrunr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jemus42/speedrunr/actions/workflows/R-CMD-check.yaml)
[![CRAN status](https://www.r-pkg.org/badges/version/speedrunr)](https://cran.r-project.org/package=speedrunr)
[![GitHub release](https://img.shields.io/github/release/jemus42/speedrunr.svg?logo=GitHub)](https://github.com/jemus42/speedrunr/releases)
[![GitHub last commit (master)](https://img.shields.io/github/last-commit/jemus42/speedrunr/master.svg?logo=GithUb)](https://github.com/jemus42/speedrunr/commits/master)
[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)The goal of speedrunr is to easily access data from [speedrun.com](https://speedrun.com).
## Installation
You can install the released version of speedrunr from GitHub with:
``` r
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:```{r, message=FALSE, error=FALSE}
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.
```{r}
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
```{r}
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.
```{r}
runs <- get_runs(game = "j1l9qz1g", category = "q255jw2o")glimpse(runs)
```And now we can basically re-create the leaderboard, but including obsoleted runs:
```{r}
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:
```{r}
get_platforms() %>%
head() %>%
kable()
```Same can be done with regions:
```{r}
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:
```{r}
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](.github/CODE_OF_CONDUCT.md).
By participating in this project you agree to abide by its terms.