Skip to contents

Analyzes historical head-to-head between a batter and bowler. Returns stats on all their previous encounters.

Usage

analyze_batter_vs_bowler(
  batter_id,
  bowler_id,
  match_type = NULL,
  source = c("local", "remote"),
  db_path = NULL
)

Arguments

batter_id

Character. Batter identifier (player_id)

bowler_id

Character. Bowler identifier (player_id)

match_type

Character. Filter by match type (e.g., "T20", "ODI", "Test"). Required for remote source.

source

Character. "local" (default) uses local DuckDB. "remote" queries GitHub releases via fast download.

db_path

Character. Database path (only used when source = "local").

Value

List with matchup statistics including balls faced, runs scored, dismissals, strike rate, and dismissal rate.

Examples

if (FALSE) { # \dontrun{
# Analyze Kohli vs Bumrah in T20s
matchup <- analyze_batter_vs_bowler("ba607b88", "12345678", match_type = "T20")

# Remote analysis
matchup <- analyze_batter_vs_bowler(
  "ba607b88", "12345678",
  match_type = "T20",
  source = "remote"
)
} # }