f1pits-intro

library(f1pits)

Vignette Info. Introduction:

The f1pits package provides datasets of Formula 1 race pit stops, extracted from DHL website and a function to visualize pit stop data.

This package can be considered complementary to the f1dataR package, which provides Formula 1 race data. You can download the package in GitHub.

Exemple to use:

Step 1: Pit Stops data

To extract the pit stop data for a specific race or an entire season, use the pits() function. Check the documentation for the different arguments of the function.

# Accessing the data, for example, round 1, Australian GP 2025:

pits(1,2025) -> pitdata
#> Australian Grand Prix 2025 / Round: 1

pitdata
#> # A tibble: 34 × 8
#>     Pos. Team         Driver     `Time (sec)`   Lap Points Round  Year
#>    <dbl> <chr>        <chr>             <dbl> <dbl>  <dbl> <int> <dbl>
#>  1     1 Ferrari      Leclerc            2.32    34     25     1  2025
#>  2     2 Ferrari      Hamilton           2.38    47     18     1  2025
#>  3     3 Mercedes     Russell            2.43    34     15     1  2025
#>  4     4 Racing Bulls Tsunoda            2.47    47     12     1  2025
#>  5     5 Haas         Bearman            2.49     4     10     1  2025
#>  6     6 Haas         Ocon               2.54     4      8     1  2025
#>  7     7 Ferrari      Hamilton           2.55    33      0     1  2025
#>  8     8 Red Bull     Verstappen         2.56    46      6     1  2025
#>  9     9 Red Bull     Lawson             2.58     4      4     1  2025
#> 10    10 Racing Bulls Tsunoda            2.67    33      0     1  2025
#> # ℹ 24 more rows

The output generated is a tibble containing the columns:

Pos. (position according to pit stop time), Team, Driver, Time (sec) is the time (in seconds) of each pitstop, Lap (lap of the race; does NOT include sprint sessions), and Points (DHL points. If a driver makes more than one pit stop among the top 10 fastest, the second and subsequent pit stops by that driver do not receive points).

Step 2 (if you want): Plotting

The f1pits package includes the pitplot() function, which takes the data obtained from pits() and produces a ggplot object to visualize pit stop performance. Remember that if you want to provide your own data, the input must be a tibble (see the documentation of pits()). Check the documentation for the different arguments of pitplot() before using it.

# Plotting the data:

pitplot(pitdata,1) -> pitplot_pitdata
#> Processing...
#>   O    _________    O
#> /|\>  _\=..o..=/_  </|\ 
#>  / \ |_|-// \\-|_| / \

pitplot_pitdata

Finally, if you want a fun text for your plot, run the ‘pitart()’ function in the title_text argument or, for example, title_text = paste0(aaa,“    Pit Stop data”).

Citations

This package makes extensive use of ‘dplyr’ for data manipulation and ‘ggplot2’ for plotting the data. ‘httr’ and ‘jsonlite’ also to access my repository data. ‘f1dataR’ has inspired me to create this package as a complement.

To cite this package in publications use:, Jordán-Soria J (2025). f1pits: F1 Pit Stop Datasets. Formula 1 pit stop data. The package provides information on teams and drivers across seasons (2025 or higher). It also includes a function to visualize pit stop performance., https://github.com/Jordan-Soria/f1pits.

A BibTeX entry for LaTeX users is

@Manual{, title = {f1pits: F1 Pit Stop Datasets}, author = {José Jordán-Soria}, year = {2025}, note = {Formula 1 pit stop data. The package provides information on teams and drivers across seasons (2025 or higher). It also includes a function to visualize pit stop performance.}, url = {https://github.com/Jordan-Soria/f1pits}, },