Browse Source

I should be better at imports and stuff.

master
Lukas Burk 1 year ago
parent
commit
30e8b94b47
Signed by: lukas GPG Key ID: 044E8B20BB186F81
4 changed files with 9 additions and 5 deletions
  1. +2
    -0
      NAMESPACE
  2. +1
    -1
      R/get.R
  3. +5
    -3
      R/utils.R
  4. +1
    -1
      man/sr_get.Rd

+ 2
- 0
NAMESPACE View File

@@ -16,3 +16,5 @@ export(get_variables_game)
export(is_outlier)
export(sr_get)
import(dplyr)
importFrom(purrr,map_chr)
importFrom(purrr,pluck)

+ 1
- 1
R/get.R View File

@@ -3,7 +3,7 @@
#' @param path API path.
#' @param ... Optional parameters
#'
#' @return A [httr] response object
#' @return The [httr::content] of the API response.
#' @export
#'
#' @examples


+ 5
- 3
R/utils.R View File

@@ -62,7 +62,7 @@ is_outlier <- function(x, method = "quantile", direction = "upper") {
#' @examples
#' \dontrun{
#' runs <- get_leaderboards(game = "j1l9qz1g")
#'
#'
#' add_platforms(runs)
#' add_regions(runs)
#' }
@@ -95,6 +95,8 @@ add_regions <- function(runs, regions = speedrunr::regions) {

#' @rdname add_miscdata
#' @import dplyr
#' @importFrom purrr pluck
#' @importFrom purrr map_chr
#' @export
add_players <- function(runs) {
# For R CMD check's global variable thing
@@ -108,9 +110,9 @@ add_players <- function(runs) {
runs %>%
select(player_id) %>%
distinct() %>%
mutate(player_name = purrr::map_chr(
mutate(player_name = map_chr(
player_id,
~ purrr::pluck(get_user(id = .x),
~ pluck(get_user(id = .x),
"name_int",
.default = NA
)


+ 1
- 1
man/sr_get.Rd View File

@@ -12,7 +12,7 @@ sr_get(path = "", ...)
\item{...}{Optional parameters}
}
\value{
A \link{httr} response object
The \link[httr:content]{httr::content} of the API response.
}
\description{
Call the speedrun.com API


Loading…
Cancel
Save