Skip to contents

Get aggregated bowling statistics with flexible filters. If bowler_id is provided, returns stats for that player. If omitted, returns stats for all bowlers matching the filters (grouped by bowler).

Usage

query_bowler_stats(
  bowler_id = NULL,
  batter_id = NULL,
  match_type = NULL,
  season = NULL,
  venue = NULL,
  city = NULL,
  country = NULL,
  event = NULL,
  date_range = NULL,
  batting_team = NULL,
  bowling_team = NULL,
  min_balls = 0,
  db_path = NULL
)

Arguments

bowler_id

Character. The bowler to get stats for. If NULL, returns stats for all bowlers matching other filters.

batter_id

Character. Filter to only deliveries to this batter (for head-to-head)

match_type

Character. Filter by match type (e.g., "t20", "odi", "test")

season

Character or numeric. Filter by season

venue

Character. Filter by venue/stadium (partial match)

city

Character. Filter by city (partial match)

country

Character. Filter by country (uses venue-to-country mapping)

event

Character. Filter by event name (partial match)

date_range

Date vector of length 2. c(start_date, end_date)

batting_team

Character. Filter by batting team

bowling_team

Character. Filter by bowling team

min_balls

Integer. Minimum balls bowled to include (default 0)

db_path

Character. Database path

Value

Data frame with bowling statistics:

  • bowler_id - Player identifier

  • balls_bowled - Total balls bowled

  • runs_conceded - Total runs conceded

  • wickets - Total wickets taken

  • dots - Dot balls bowled

  • bowling_average - Runs per wicket

  • runs_per_ball - Runs conceded per ball

  • economy_rate - Runs per over (6 balls)

  • wicket_pct - Wicket percentage per ball

  • strike_rate - Balls per wicket

Examples

if (FALSE) { # \dontrun{
# Single player stats
query_bowler_stats("J Bumrah", match_type = "t20")

# Head-to-head vs specific batter
query_bowler_stats("J Bumrah", batter_id = "V Kohli")

# All bowlers in Test cricket (min 100 balls)
query_bowler_stats(match_type = "test", min_balls = 100)

# All bowlers in IPL
query_bowler_stats(event = "Indian Premier League", min_balls = 50)

# All bowlers in England
query_bowler_stats(country = "England", match_type = "test", min_balls = 100)
} # }