Package {f1pits}


Type: Package
Title: F1 Pit Stop Datasets
Version: 1.3.0
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-11 19:37:31 UTC; Jose
Author: José Jordán-Soria [aut, cre]
Repository: CRAN
Date/Publication: 2026-05-11 20:10:03 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). Can be a range 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, k = 20, 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

k

Velocity factor magnitude to change ELO ratings (by default, 20)

d

Scaling factor used in the expected 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 tibble provided (if is omitted, each ELO value team will be 1000 by default)

Value

A tibble containing the ELO calculations

Examples


pitstop_data_elo_example <- tibble::tibble(
  Pos. = 1:11,
  Team = c("Team_1","Team_2","Team_2","Team_2","Team_2",
           "Team_3","Team_2","Team_1","Team_1","Team_3","Team_1"),
  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 = 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)