pcs

A data package for querying rider data from procyclingstats.com

The goal of pcs is to provide programmatic methods for querying professional cycling race results and rider biographical information from procyclingstats.com.

Installation

devtools::install_github("seanhardison1/pcs")

Usage

The main function in pcs is query_pcs, which scrapes rider results and biographical information from the PCS website. Usage is as follows:

pcs::query_pcs("Peter Sagan", seasons = c(2020, 2021))

If no season years are specified, then query_pcs will pull all available data for the rider name(s) passed into the function as a character vector.

Rider results are returned as a list of two data frames: profiles, containing biographical information, and results, containing race results. The results data frame may contain numeric entries that pertain to DNF, DNS, DSQ, etc, and are defined as follows:

Result flag Code
DNF 999
DNS 998
OTL 997
DF 996
NQ 995
DSQ 994
NR 993

The profiles data frame contains columns for total PCS points in the categories of Onedayraces, GC, TT, Sprint, Climber, and Hills. Caution is warranted when analyzing rider biographical information from PCS. It is not legal to use data scraped from PCS for commercial purposes. Also, never forget that these folks are more than just numbers!!