MyNixOS website logo
Description

Efficiently Access Pro Golf Data.

Fetch Professional Golfers' Association (PGA) Tour tournament data from ESPN <https://www.espn.com/golf/> including leaderboards and hole-by-hole scoring. Data is returned in tidy tibble format ready for analysis. Supports local storage via RDS or 'Apache Arrow' Parquet files for fast repeated access. Designed for golf analytics, data journalism, and fantasy sports research.

golfastR golfastR logo

Fast, tidy Pro Golf data in R

golfastR provides easy access to professional golf data from ESPN with functions to get leaderboards and hole-by-hole scores in tidy data formats ready for analysis. Supports PGA Tour, LIV Golf, LPGA, DP World Tour, and Champions Tour.

Installation

# Install from CRAN
install.packages("golfastr")

# Or install development version from GitHub
# install.packages("pak")
pak::pak("array-carpenter/golfastr")

Supported Tours

TourCodeExample
PGA Tour"pga"load_schedule(2026, tour = "pga")
LIV Golf"liv"load_schedule(2026, tour = "liv")
LPGA"lpga"load_schedule(2026, tour = "lpga")
DP World Tour"euro"load_schedule(2026, tour = "euro")
Champions Tour"champions"load_schedule(2026, tour = "champions")

All functions accept the tour parameter. Default is "pga".

Quick Start

library(golfastr)

# Get the PGA tournament schedule
schedule <- load_schedule(2026)

# Load a tournament leaderboard
sony <- load_leaderboard(2026, "Sony")

# Get hole-by-hole scoring for top 10
holes <- load_holes(2026, "Sony", top_n = 10)

# LIV Golf works the same way
liv_schedule <- load_schedule(2026, tour = "liv")
adelaide <- load_leaderboard(2026, "Adelaide", tour = "liv")

Strokes Gained

Pre-built PGA Tour strokes gained data ships with the package:

# Get all strokes gained data
sg <- load_strokes_gained()

# Look up a specific player
load_strokes_gained("Scheffler")

Returns per-round averages for all six SG categories:

FieldDescription
sg_puttStrokes Gained: Putting
sg_argStrokes Gained: Around the Green
sg_appStrokes Gained: Approach the Green
sg_ottStrokes Gained: Off the Tee
sg_t2gStrokes Gained: Tee to Green
sg_totalStrokes Gained: Total

Core Functions

Tournament Schedule

# Get schedule for a season
schedule <- load_schedule(2026)

# LIV Golf schedule
liv <- load_schedule(2026, tour = "liv")

# Returns: event_id, tournament_name, start_date, end_date

Leaderboards

# Load by tournament name (partial match)
masters <- load_leaderboard(2026, "Masters")
phoenix <- load_leaderboard(2026, "Phoenix")

# Load by event ID
lb <- load_leaderboard(2026, "401703504")

# Load all tournaments for the year
all_lb <- load_leaderboard(2026)

# LIV Golf leaderboard
liv_lb <- load_leaderboard(2026, "Adelaide", tour = "liv")

Hole-by-Hole Scoring

# Get scorecards for top finishers
holes <- load_holes(2026, "Sony", top_n = 10)

# Returns: player_id, player_name, round, hole, par, score, score_type

Player Directory

# Get players from recent tournaments
players <- load_players(2026)

Data Schema

Leaderboard

FieldDescription
positionFinal standing
player_idESPN athlete ID
player_namePlayer display name
total_scoreTotal strokes
score_to_parScore vs par (e.g., "-11")
statusPlayer status

Hole-by-Hole

FieldDescription
roundRound number (1-4)
holeHole number (1-18)
parPar for hole
scoreStrokes on hole
score_typeBIRDIE, PAR, BOGEY, EAGLE, etc.

Local Storage

Store data locally for faster repeated access:

# Save to RDS (native R format)
save_to_rds(leaderboard_data, file_path = "golf_data.rds")

# Load from RDS
data <- load_from_rds(file_path = "golf_data.rds")

# Or use Parquet for cross-language compatibility (requires arrow)
save_to_parquet(leaderboard_data, file_path = "golf_data.parquet")
data <- load_from_parquet(file_path = "golf_data.parquet")

# Auto-detect format with load_data()
data <- load_data("golf_data.rds")
data <- load_data("golf_data.parquet", tournament = "Masters")

Build a Season Database

# Incrementally fetch all tournaments for a season
build_season(2025, file_path = "pga_2025.rds")

# Check progress
check_season(2025, file_path = "pga_2025.rds")

Analysis Functions

# Player season summary
player_summary("Scheffler", file_path = "golf_data.rds")

# Compare multiple players
compare_players(c("Scheffler", "McIlroy"), file_path = "golf_data.rds")

# Win leaders
win_leaders(file_path = "golf_data.rds")

# Scoring average leaders
scoring_avg_leaders(file_path = "golf_data.rds")

Data Source

Tournament data is sourced from ESPN's Golf API (Strokes gained data is sourced from the PGA Tour (<https://www.pgatour.com/stats).

License

MIT.

Metadata

Version

0.2.0

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows