Title: NASCAR Race Data
Version: 3.0.0
Description: A collection of NASCAR race, driver, owner and manufacturer data across the three major NASCAR divisions: NASCAR Cup Series, NXS, and NASCAR Craftsman Truck Series. The curated data begins with the 1949 season and is updated weekly during the racing season. Explore race, season, or career performance for drivers, teams, and manufacturers throughout NASCAR's history. Data was sourced with permission from DriverAverages.com.
License: GPL (≥ 3)
Depends: R (≥ 4.1.0)
Encoding: UTF-8
RoxygenNote: 7.3.3
Imports: arrow, dplyr, glue, rlang, stringdist, stringr
Suggests: conflicted, curl, ggtext, httr2, jsonlite, knitr, paws.storage, purrr, rmarkdown, roxygen2, rvest, scales, testthat (≥ 3.0.0), tidyverse
Config/testthat/edition: 3
VignetteBuilder: knitr
URL: https://www.kylegrealis.com/nascaR.data/
BugReports: https://github.com/kyleGrealis/nascaR.data/issues
NeedsCompilation: no
Packaged: 2026-02-14 00:10:18 UTC; kyle
Author: Kyle Grealis ORCID iD [aut, cre], Nick Triplett [ctb], Gabriel Odom ORCID iD [ctb]
Maintainer: Kyle Grealis <kylegrealis@proton.me>
Repository: CRAN
Date/Publication: 2026-02-14 14:40:22 UTC

Clear Cached NASCAR Data

Description

Removes all cached NASCAR series data from both memory and disk. The next call to load_series() will re-download data from cloud storage.

Usage

clear_cache()

Value

Invisibly returns NULL.

See Also

load_series() for data access.

Examples

## Not run: 
# Clear all cached data
clear_cache()

# Force fresh download
cup <- load_series("cup")

## End(Not run)


Get Driver Info with Smart Matching

Description

Search for a driver by name and return career statistics. Supports partial names, typos, and case-insensitive input via the built-in fuzzy matching engine.

Usage

get_driver_info(driver, series = "all", type = "summary", interactive = TRUE)

Arguments

driver

Character string of the driver name to search for. Supports partial names and common misspellings (e.g., "earnhart" finds Earnhardt).

series

Character string ("cup", "nxs", "truck", "all") or a pre-loaded data frame. Default is "all".

type

Character string specifying the return format:

"summary"

Career totals grouped by series (Seasons, Career Races, Wins, Best Finish, Avg Finish, Laps Raced, Laps Led).

"season"

Season-by-season breakdown (Races, Wins, Best Finish, Avg Finish, Laps Raced, Laps Led).

"all"

Complete race-by-race results.

interactive

Logical. When TRUE (default) and the R session is interactive, prompts the user to select from multiple matches. When FALSE, silently uses the first match.

Value

A tibble of driver statistics (format depends on type), or invisible(NULL) if no match is found.

See Also

get_team_info(), get_manufacturer_info(), load_series(), series_data

Examples


# Career summary across all series
get_driver_info("Christopher Bell")

# Season-by-season Cup data
get_driver_info(
  "Christopher Bell",
  series = "cup",
  type = "season"
)


Get Manufacturer Info with Smart Matching

Description

Search for a manufacturer by name and return performance statistics. Uses fuzzy matching to handle partial names, typos, and case-insensitive searches.

Usage

get_manufacturer_info(
  manufacturer,
  series = "all",
  type = "summary",
  interactive = TRUE
)

Arguments

manufacturer

Character string of the manufacturer name to search for.

series

Character string ("cup", "nxs", "truck", "all") or a pre-loaded data frame. Default is "all".

type

Character string specifying the return format:

"summary"

Career totals grouped by series (Seasons, Races, Wins, Best Finish, Avg Finish, Laps Raced, Laps Led).

"season"

Season-by-season breakdown (Races, Wins, Best Finish, Avg Finish, Laps Raced, Laps Led).

"all"

Complete race-by-race results.

interactive

Logical. When TRUE (default) and the R session is interactive, prompts the user to select from multiple matches. When FALSE, silently uses the first match.

Value

A tibble of manufacturer statistics (format depends on type), or invisible(NULL) if no match is found.

See Also

get_driver_info(), get_team_info(), load_series(), series_data

Examples


# Career summary across all series
get_manufacturer_info("Toyota")

# Season-by-season Cup data
get_manufacturer_info(
  "Toyota",
  series = "cup",
  type = "season"
)


Get Team Info with Smart Matching

Description

Search for a team by name and return performance statistics. Supports partial names, typos, and case-insensitive input via the built-in fuzzy matching engine.

Usage

get_team_info(team, series = "all", type = "summary", interactive = TRUE)

Arguments

team

Character string of the team name to search for. Supports partial names and common misspellings (e.g., "gibbs" finds Joe Gibbs Racing).

series

Character string ("cup", "nxs", "truck", "all") or a pre-loaded data frame. Default is "all".

type

Character string specifying the return format:

"summary"

Career totals grouped by series (Seasons, Career Races, # of Drivers, Wins, Best Finish, Avg Finish, Laps Raced, Laps Led).

"season"

Season-by-season breakdown (Races, # of Drivers, Wins, Best Finish, Avg Finish, Laps Raced, Laps Led).

"all"

Complete race-by-race results.

interactive

Logical. When TRUE (default) and the R session is interactive, prompts the user to select from multiple matches. When FALSE, silently uses the first match.

Value

A tibble of team statistics (format depends on type), or invisible(NULL) if no match is found.

See Also

get_driver_info(), get_manufacturer_info(), load_series(), series_data

Examples


# Career summary across all series
get_team_info("Joe Gibbs Racing")

# Season-by-season Cup data
get_team_info(
  "Joe Gibbs Racing",
  series = "cup",
  type = "season"
)


Load NASCAR Series Data

Description

Downloads NASCAR series data from Cloudflare R2 as a parquet file. Uses two-tier caching (memory + disk) for performance. On first call, data is downloaded and cached locally. Subsequent calls return cached data instantly.

Usage

load_series(series = c("cup", "nxs", "truck"), refresh = FALSE)

Arguments

series

Character. The series to load. One of "cup", "nxs", or "truck".

refresh

Logical. If TRUE, bypass the cache and re-download from cloud storage. Default is FALSE.

Details

Why "nxs"?

NASCAR's NXS uses the sponsor-neutral identifier "nxs" rather than a sponsor name. The series has been sponsored by Busch (1984-2007), Nationwide (2008-2014), Xfinity (2015-2025), and O'Reilly Auto Parts (2026-present). Using "nxs" keeps the identifier stable across sponsor changes.

Caching

Data is cached in two tiers:

Use refresh = TRUE to force a fresh download, or clear_cache() to remove all cached data.

Value

A data frame with 21 columns of race results: Season, Race, Track, Name, Length, Surface, Finish, Start, Car, Driver, Team, Make, Pts, Laps, Led, Status, S1, S2, S3, Rating, and Win.

See Also

series_data for column descriptions, clear_cache() for cache management, get_driver_info() for driver statistics.

Examples


# Load Cup Series data (downloads on first call, cached after)
cup <- load_series("cup")

# Load NXS data
nxs <- load_series("nxs")

# Load Truck Series data
truck <- load_series("truck")

# Force re-download from cloud storage
cup <- load_series("cup", refresh = TRUE)



NASCAR Series Data

Description

Historical race results from NASCAR's three major national series, sourced with permission from DriverAverages.com. Data is hosted on Cloudflare R2 and accessed via load_series().

Cup Series (1949–present)

The NASCAR Cup Series is the sport's premier division. Originally called the Strictly Stock Series in its inaugural 1949 season, it has been known by several names tied to title sponsors: Grand National (1950–1970), Winston Cup (1971–2003), Nextel Cup (2004–2007), Sprint Cup (2008–2016), Monster Energy Cup (2017–2019), and the NASCAR Cup Series (2020–present).

cup <- load_series("cup")

Xfinity / O'Reilly Auto Parts Series (1982–present)

NASCAR's second-tier national series, often considered a proving ground for drivers aspiring to reach the Cup Series. It debuted in 1982 as the Budweiser Late Model Sportsman Series and has carried the names of several title sponsors: Busch Series (1984–2007), Nationwide Series (2008–2014), Xfinity Series (2015–2025), and the O'Reilly Auto Parts Series (2026–present).

nxs <- load_series("nxs")

The series identifier is "nxs", NASCAR's own sponsor-neutral abbreviation. This avoids tying the code to any single title sponsor.

Truck Series (1995–present)

The NASCAR Craftsman Truck Series features modified pickup trucks racing on a mix of ovals, short tracks, road courses, and dirt tracks. It launched in 1995 as the SuperTruck Series and has been sponsored under the names Craftsman Truck (1995–2008), Camping World Truck (2009–2022), and Craftsman Truck again (2023–present).

truck <- load_series("truck")

Variables

All three series share the same column structure:

Season

Integer. Year the race took place.

Race

Integer. Race number within the season.

Track

Character. Name of the track or venue.

Name

Character. Official race name (includes sponsor).

Length

Numeric. Track length in miles.

Surface

Character. Track surface type (e.g., "Paved", "Dirt").

Finish

Integer. Official finishing position.

Start

Integer. Starting grid position.

Car

Character. Car number.

Driver

Character. Driver's full name.

Team

Character. Team or car owner name.

Make

Character. Vehicle manufacturer (e.g., "Chevrolet", "Ford", "Toyota").

Pts

Integer. Championship points earned.

Laps

Integer. Total laps completed.

Led

Integer. Number of laps led.

Status

Character. Race completion status (e.g., "Running", "Crash", "Engine").

S1

Numeric. Stage 1 points (2017–present, NA for earlier seasons).

S2

Numeric. Stage 2 points (2017–present, NA for earlier seasons).

S3

Numeric. Stage 3 points. Cup Series only, 2024–present (NA for NXS, Truck, and pre-2024 Cup).

Rating

Numeric. Driver/loop rating for the race (NA where unavailable).

Win

Integer. Win indicator (1 = won, 0 = did not win).

Data Source

All data is sourced with permission from DriverAverages.com and updated weekly via an automated pipeline. See load_series() for access details and clear_cache() for cache management.