Browse Source

docs, vignette

master
Lukas Burk 4 months ago
parent
commit
4e9c26cfcd
Signed by: lukas <lukas@quantenbrot.de> GPG Key ID: 044E8B20BB186F81
7 changed files with 41 additions and 26 deletions
  1. +1
    -1
      DESCRIPTION
  2. +1
    -1
      man/get_leaderboard.Rd
  3. +9
    -2
      man/get_runs.Rd
  4. +1
    -1
      man/get_variables_game.Rd
  5. +8
    -4
      man/platformsregions.Rd
  6. +1
    -1
      man/speedrunr-package.Rd
  7. +20
    -16
      vignettes/ocarina-of-time-100.Rmd

+ 1
- 1
DESCRIPTION View File

@@ -36,4 +36,4 @@ ByteCompile: true
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 6.1.1
RoxygenNote: 7.1.0

+ 1
- 1
man/get_leaderboard.Rd View File

@@ -13,7 +13,7 @@ get_leaderboard(game, category, level = NULL, top = 100, ...)

\item{level}{The level \code{id}, if a per-level leaderboard is requested.}

\item{top}{\code{[100]}. How many places to return. Note there might be multiple runs per place.}
\item{top}{\verb{[100]}. How many places to return. Note there might be multiple runs per place.}

\item{...}{Optional arguments to the API.}
}


+ 9
- 2
man/get_runs.Rd View File

@@ -7,8 +7,15 @@
\url{https://github.com/speedruncomorg/api/blob/master/version1/runs.md#get-runs}
}
\usage{
get_runs(game, category, max = 100, status = "verified",
offset = NULL, verbose = FALSE, ...)
get_runs(
game,
category,
max = 100,
status = "verified",
offset = NULL,
verbose = FALSE,
...
)
}
\arguments{
\item{game}{The game's id.}


+ 1
- 1
man/get_variables_game.Rd View File

@@ -12,7 +12,7 @@ get_variables_game(game, list_column = FALSE)
\arguments{
\item{game}{The game's \code{id}}

\item{list_column}{\code{[FALSE]} Whether to return a list column or a flat \code{tbl}.}
\item{list_column}{\verb{[FALSE]} Whether to return a list column or a flat \code{tbl}.}
}
\value{
A \link[tibble:tibble]{tibble::tibble} with one row per \code{variable} \emph{or}


+ 8
- 4
man/platformsregions.Rd View File

@@ -5,10 +5,14 @@
\alias{platforms}
\alias{regions}
\title{Platform and Region data from speedrun.com}
\format{\describe{
\item{platforms}{A \code{tibble} with 99 rows and 3 variables: \code{id, name, released}}
\item{regions}{A \code{tibble} with 6 rows and 2 variables: \code{id, name}}
}}
\format{
\describe{
\item{platforms}{A \code{tibble} with 99 rows and 3 variables: \verb{id, name, released}}
\item{regions}{A \code{tibble} with 6 rows and 2 variables: \verb{id, name}}
}

An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 6 rows and 2 columns.
}
\usage{
platforms



+ 1
- 1
man/speedrunr-package.Rd View File

@@ -18,7 +18,7 @@ Useful links:

}
\author{
\strong{Maintainer}: Lukas Burk \email{lukas@quantenbrot.de} (0000-0001-7528-3795)
\strong{Maintainer}: Lukas Burk \email{lukas@quantenbrot.de} (\href{https://orcid.org/0000-0001-7528-3795}{ORCID})

}
\keyword{internal}

+ 20
- 16
vignettes/ocarina-of-time-100.Rmd View File

@@ -27,6 +27,8 @@ I like Ocarina of Time 100%. So let's take a look at that.
First up we need the game's ID and category ID. That's easy:

```{r}
library(dplyr)
library(kableExtra)
library(speedrunr)

get_games("Ocarina of Time")
@@ -54,9 +56,6 @@ str(oot100)
We want some additional data:

```{r}
library(dplyr)
library(knitr)

oot100 <- oot100 %>%
add_platforms() %>%
add_regions() %>%
@@ -64,9 +63,10 @@ oot100 <- oot100 %>%

oot100 %>%
arrange(time_hms) %>%
select(time_hms, player_name, date, system_platform, system_region) %>%
select(time_hms, record, player_name, date, system_platform, system_region) %>%
head(10) %>%
kable()
kable() %>%
kable_styling()
```

## Category Overview
@@ -80,7 +80,7 @@ library(hrbrthemes)
library(hms)

oot100 %>%
filter(time_hms < hms::hms(hours = 6)) %>%
filter(time_hms < hms::hms(hours = 5)) %>%
{
ggplot(., aes(date, time_hms)) +
geom_point(size = 1, alpha = .75) +
@@ -95,7 +95,7 @@ oot100 %>%
labs(title = "Ocarina of Time: 100% Speedrun Record History",
subtitle = paste0("All data from speedrun.com (n = ", nrow(.), ")"),
x = "Date of Run", y = "Time",
color = "Runner", caption = "Data limited to sub 6h runs") +
color = "Runner", caption = "Data limited to sub 5h runs") +
theme_ipsum() +
theme(legend.position = "top")
}
@@ -121,21 +121,25 @@ bind_rows(
ungroup
) %>%
{
ggplot(., aes(x = date, y = time_hms, color = player_name, fill = player_name)) +
ggplot(., aes(x = date, y = time_hms,
color = player_name, fill = player_name)) +
geom_point(size = 1, alpha = .75) +
geom_step() +
geom_label_repel(data = .
%>% group_by(player_name) %>%
summarize(y = min(time_hms), x = max(date)),
aes(label = player_name, x = x, y = y),
color = "black", alpha = .75, show.legend = F,
hjust = 1, direction = "y", nudge_x = 60^2) +
geom_label_repel(
data = . %>%
group_by(player_name) %>%
summarize(y = min(time_hms), x = max(date)),
aes(label = player_name, x = x, y = y),
color = "black", alpha = .75, show.legend = F,
hjust = 1, direction = "y", nudge_x = 60^2
) +
scale_x_date(date_breaks = "1 month", date_labels = "%b '%y",
limits = c(as.Date(NA), today() + days(45))) +
scale_y_time(breaks = seq(0, 20 * 60^2, 1/12 * 60^2),
minor_breaks = seq(0, 20 * 60^2, 1/24 * 60)) +
scale_color_brewer(palette = "Dark2", guide = F) +
scale_fill_brewer(palette = "Dark2", guide = F) +
scale_color_viridis_d(
direction = -1, guide = FALSE, aesthetics = c("color", "fill")
) +
labs(title = "Ocarina of Time: 100% Speedruns",
subtitle = "All runs of the past 6 months",
caption = "Data from speedrun.com",


Loading…
Cancel
Save