The goal of parkrunfunctions is to …
You can install the development version of parkrunfunctions from GitHub with:
# install.packages("pak")
pak::pak("sgbstats/parkrunfunctions")After each function call, if using a loop, add a break of 20-25 secs to not overload the website.
To get the complete history of a parkrunner, you need their unique
parkrun ID. You can find this ID in the URL of their results page (e.g.,
https://www.parkrun.org.uk/parkrunner/1674/).
The get_all_runs() function takes a Parkrunner ID and returns a list
containing the runner’s name, ID, and a data frame of all their results.
parkrunner_id <- 1674
runner_history <- get_all_runs(id = parkrunner_id)
# View the structure of the returned object
print(runner_history$name)
print(head(runner_history$results))You can retrieve the results for a single parkrun event using the
get_result() function. You can either provide the full URL of the
results page or specify the event name and event_no.
# Option 1: Using the URL
event_url <- "https://www.parkrun.org.uk/bushy/results/1/"
event_results <- get_result(url = event_url)
# Option 2: Using event name and number
event_results_alt <- get_result(event = "bushy", event_no = 1)
# The function returns a list with two data frames: results and volunteers
print(head(event_results$results))
print(head(event_results$volunteers))The results contain name, id, time and age grade. ## License
This project is licensed under the MIT License. See the LICENSE file for details.