Skip to contents

Get batting statistics for one or all teams. Includes runs scored, average, strike rate, and boundary metrics.

Usage

team_batting_stats(
  team = NULL,
  match_type = NULL,
  season = NULL,
  min_matches = 10,
  source = c("local", "remote"),
  db_path = NULL
)

Arguments

team

Character. Team name (e.g., "India", "Australia"). If NULL (default), returns stats for all teams.

match_type

Character. Filter by match type: "T20", "ODI", "Test", "IT20", "MDM", or NULL for all formats. Required for remote source.

season

Character. Filter by season (e.g., "2023", "2023/24").

min_matches

Integer. Minimum matches to include (default 10). Only applies when team is NULL.

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

Data frame with team batting metrics:

  • team, matches, innings, balls_faced, runs_scored, wickets_lost

  • batting_average, strike_rate, boundary_percentage

Examples

if (FALSE) { # \dontrun{
# Get all teams' batting stats
all_teams <- team_batting_stats()

# Get T20 batting stats for all teams
t20_teams <- team_batting_stats(match_type = "T20")

# Get stats for a specific team
india_batting <- team_batting_stats("India")

# Get T20 stats for a specific team
india_t20 <- team_batting_stats("India", match_type = "T20")

# Get T20 stats from remote (no local install needed)
remote_stats <- team_batting_stats(match_type = "T20", source = "remote")
} # }