The goal of crossfit is to provide both high and low level access to the CrossFit API for both the CrossFit Games and the CrossFit Open. This API isn’t documented, but seems somewhat stable.
Because each endpoint seems to accept different subsets of parameters, it seemed easiest to wrap up a few of the common ones into high level helpers (cf_open()
and cf_games()
) while also providing low level access to the API (cf_request()
and cf_req_*()
helpers).
Installation
You can install the development version of crossfit from GitHub with:
# install.packages("devtools")
devtools::install_github("DavisVaughan/crossfit")
Example
See cf_open()
and cf_games()
for high level access to the API. Their help pages have a few examples. See cf_request()
for low level access.
The results from cf_open()
and cf_games()
have been lightly pre-processed, but you typically need to use some tidyr wrangling tools to extract data of interest.
library(crossfit)
library(dplyr)
library(tidyr)
cf_open(2022, division = cf_division$`Men (45-49)`, n_pages = 1) %>%
unnest_wider(entrant) %>%
hoist(scores, one = 1) %>%
select(competitorName, one) %>%
unnest_wider(one) %>%
select(competitorName, affiliate, score, breakdown)
#> # A tibble: 100 × 4
#> competitorName affiliate score breakdown
#> <chr> <chr> <chr> <chr>
#> 1 Angel Cardenas CrossFit Galvanize 3000000 "10 rounds\n"
#> 2 Fernando Gonçalves Equilibrio CrossFit 2830000 "9 rounds +\n3 wall walk…
#> 3 Jason Grubb <NA> 2930000 "9 rounds +\n3 wall walk…
#> 4 Justin LaSala <NA> 2890000 "9 rounds +\n3 wall walk…
#> 5 Luiz Carlos Corniatti CrossFit Aclimacao 2850000 "9 rounds +\n3 wall walk…
#> 6 Stephen Vassallo CrossFit Hardshells 3000000 "10 rounds\n"
#> 7 Chris Scott <NA> 2820000 "9 rounds +\n3 wall walk…
#> 8 Yurii Hanson CrossFit Billings 2930000 "9 rounds +\n3 wall walk…
#> 9 Craig Robinson Fort to Fort CrossFit 2720000 "9 rounds +\n2 wall walk…
#> 10 Peter Andersson CrossFit Lomma 2900000 "9 rounds +\n3 wall walk…
#> # … with 90 more rows