cf_games | R Documentation |
cf_games()
retrieves data from the CrossFit Games API, lightly
pre-processed. If you need low level access to the API, use cf_request()
.
If no data is returned by the API, an empty tibble with zero columns and zero rows is returned.
You'll typically need to use tidyr::unnest_wider()
and tidyr::hoist()
to
further process this data.
cf_games( year, ..., division = cf_division$Men, n_pages = NULL, progress = TRUE )
year |
The year to retrieve data for. Note that not all parameters will be valid for past years. |
... |
These dots are for future extensions and must be empty. |
division |
The division to retrieve data for. One of the values in cf_division. |
n_pages |
An optional integer to limit the number of pages returned. Each page will have a maximum of 100 rows returned. This is useful if you just want to explore the data without downloading all of it. If not specified, this will download all available data. |
progress |
Should a progress bar be shown for longer downloads? |
A tibble.
library(tidyr) library(dplyr) games <- cf_games(2021) # 15 workouts in the 2021 CrossFit games games %>% unnest_wider(entrant) %>% hoist(scores, two = 2) %>% select(competitorName, two) %>% unnest_wider(two) %>% select(competitorName, score, breakdown) # What affiliates were the top 20 associated with? # (This is also a way to find an affiliate ID) games %>% unnest_wider(entrant) %>% slice(1:20) %>% select(competitorName, affiliateId, affiliateName)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.