| Type: | Package |
| Title: | F1 Pit Stop Datasets |
| Version: | 1.3.1 |
| Maintainer: | José Jordán-Soria <jjose.jjordan@gmail.com> |
| Description: | Formula 1 pit stop data. The package provides information on teams and drivers across seasons (2019 or higher). It also includes a function to visualize pit stop performance. |
| Imports: | dplyr, ggplot2, readr, tibble, httr, jsonlite, f1dataR |
| Suggests: | testthat (≥ 3.0.0), knitr, rmarkdown |
| VignetteBuilder: | knitr |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.2 |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2026-05-20 16:28:38 UTC; Jose |
| Author: | José Jordán-Soria [aut, cre] |
| Repository: | CRAN |
| Date/Publication: | 2026-05-20 16:40:08 UTC |
F1 pitstop ASCII art
Description
Funny ASCII F1 pitstop for title_text argument in pitplot() function
Usage
pitart(n = 1)
Arguments
n |
Integer. ASCII pit stop to generate. From 1 (by default) to 5 |
Format
ASCII string
Value
A string containing the ASCII art of a F1 pit stop
Examples
pitart(1)
pitart(2)
pitart(3)
pitart(5)
Pit stop standings by season
Description
Pit stop official standings by season (since 2015)
Usage
pitchamp(year)
Arguments
year |
Season pit stop standings (integer), set of years a:b (vector) or "all" (character). 2015 or higher. |
Value
A tibble containing the pit stop season standings points (or wins for 2015 and 2016)
Examples
pitchamp(2015)
ELO calculation using pit stop data
Description
Function to calculate ELO ratings from a pit stop dataset
Usage
pitelo(
pits_data,
stat_fun = 1,
calc = 1,
k = 20,
c = 10,
d = 400,
fml = TRUE,
elo = NULL
)
Arguments
pits_data |
Tibble data generated by the pits() function |
stat_fun |
Type of stat used in ELO calculations: median (1, by default), mean (2) and min value (3) position |
calc |
Type of calculation: batch (1, by default) or sequential (2) |
k |
Weight factor magnitude (velocity) to change ELO ratings (by default, 20) |
c |
Base factor that establishes the win probability ratio between two teams for a given rating difference in the score ELO calculation (by default, 10) |
d |
Scaling factor amplitude that determines the sensitivity of the expected win probability to rating differences in the score ELO calculation (by default, 400) |
fml |
Team family mode. Collapse the different names of the same team structure (by default TRUE, enabled) |
elo |
ELO provided (if is omitted, 1000 will be used for all by default) |
Details
The function calculates ELO ratings, using the position of each team's pit stop in each round.
By default, the median stat is used because it better reflects global pit stop performance across teams. It is less sensitive to extreme real data values and outliers, but provides more stability than the mean. For example, a single poor pit stop does not significantly affect efficiency.
Meanwhile, the mean is more affected by small sample sizes or outliers, such as penalties served by a driver during pit stops, but it is more sensitive to pit stop mistakes.
The last statistic uses the best pit stop result by team, ignoring consistency and reflecting maximum peak of performance potential.
On the other hand, two methodologies can be applied for ELO calculation: sequential or batch.
In the sequential approach, the ELO is updated after each match intra-event, so depends on the order in which matchups are processed. This changes future expectations within the same race, reinforcing early leadership while reducing later gains for the leader and smoothing final differences. Consequently, this approach is more suitable for analyzing individual races.
In contrast, the batch approach updates the ELO only after the entire event has finished. Race matchups are not considered immediately; instead they are aggregated afterward, making long-term comparisons more fair, neutral and independent of temporal order.
k parameter controls the magnitude of change in each ELO cycle calculation.
c establishes the win probability ratio between two teams based on a specific difference in rating points.
d is the expected probability to win (sensitivity).
Default values k, c and d used are based on Hvattum and Arntzen (2010). With these default values, a 400 point ELO difference implies that the stronger team has 10 times more chances of winning than the weaker team.
Value
A tibble containing the ELO calculations
References
Elo, A. E. (1978). The rating of chessplayers, past and present. Arco Publishing. ISBN-10: 0668047216.
Glickman, M. E., & Jones, A. C. (1999). Rating the chess rating system. CHANCE-BERLIN THEN NEW YORK-, 12, 21-28.
Hvattum, L. M., & Arntzen, H. (2010). Using ELO ratings for match result prediction in association football. International Journal of Forecasting, 26(3), 460–470. doi:10.1016/j.ijforecast.2009.10.002.
Examples
pitstop_data_elo_example <- tibble::tibble(
Pos. = 1:11,
Team = c("Team_3","Team_1","Team_1","Team_1","Team_1",
"Team_2","Team_1","Team_3","Team_3","Team_2","Team_3"),
Driver = rep("Driver", 11),
"Time (sec)" = c(2.18, 2.21, 2.24, 3, 4, 4.04, 4.07, 4.08, 7.88, 8.88, 14.54),
Lap = 1:11,
Points = rep(0, 11),
Round = rep(0, 11),
Year = rep(2026, 11))
pitelo(pitstop_data_elo_example)
pitelo(pitstop_data_elo_example, stat_fun = 2)
pitelo(pitstop_data_elo_example, stat_fun = 3)
Plot pit stop results
Description
Plot pit stop results (MUST BE in tibble format)
Usage
pitplot(pits_data, type = 3, title_text = NULL)
Arguments
pits_data |
Tibble data generated by the pits() function |
type |
Plot type: individual pit stop by driver (1), grouped by team (2), grouped by driver (3, by default) |
title_text |
Text for the plot title, in quotes (" ") (if is omitted, a default text will be used). |
Format
Tibble
Value
A ggplot object
Examples
pitplot(pits(10, 2025), 1, "Title: Hello world!")
Pit stops of a race or set
Description
Pit stop results of a race or set
Usage
pits(round, year)
Arguments
round |
Number of the race (integer), set of races a:b (vector) or "all" (character) |
year |
Year of the race (integer). 2019 or higher |
Value
A tibble containing the pit stops values of the specified race(s)
Examples
pits(10, 2025)
pits(1:2, 2025)