Query ball-by-ball delivery data with flexible filters.
Usage
query_deliveries(
match_id = NULL,
match_type = NULL,
player_id = NULL,
batter_id = NULL,
bowler_id = NULL,
season = NULL,
venue = NULL,
city = NULL,
country = NULL,
event = NULL,
date_range = NULL,
batting_team = NULL,
bowling_team = NULL,
limit = NULL,
source = c("local", "remote"),
db_path = NULL
)Arguments
- match_id
Character. Specific match ID
- match_type
Character. Filter by match type (e.g., "t20", "odi", "test"). Required for remote source (deliveries are partitioned by format).
- player_id
Character. Filter by batter or bowler (either role)
- batter_id
Character. Filter by specific batter
- bowler_id
Character. Filter by specific bowler
- 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). Not available for remote source.
- event
Character. Filter by event name (partial match, e.g., "Premier League"). Not available for remote source.
- 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
- limit
Integer. Limit number of results
- source
Character. "local" (default) uses local DuckDB. "remote" queries GitHub releases via fast download.
- db_path
Character. Database path (only used when source = "local").
Examples
if (FALSE) { # \dontrun{
# Get all deliveries for a specific match
match_balls <- query_deliveries(match_id = "12345")
# Get all deliveries faced by a player
kohli_balls <- query_deliveries(batter_id = "V Kohli", limit = 1000)
# Get all deliveries bowled by a player in Australia
bumrah_aus <- query_deliveries(bowler_id = "J Bumrah", country = "Australia")
# Get IPL deliveries for a matchup
matchup <- query_deliveries(
batter_id = "V Kohli",
bowler_id = "J Bumrah",
event = "Indian Premier League"
)
# Query from remote (requires match_type)
t20_balls <- query_deliveries(
match_type = "T20",
batter_id = "ba607b88",
source = "remote",
limit = 1000
)
} # }
