cricket {gravitas} | R Documentation |
Cricket data set for different seasons of Indian Premier League
Description
The Indian Premier League played by teams representing different cities in India from 2008 to 2016.
Usage
cricket
Format
A tibble with 8560 rows and 11 variables.
- season
years representing IPL season
- match_id
match codes
- batting_team
name of batting team
- bowling_team
name of bowling team
- inning
innings of the match
- over
overs of the inning
- wicket
number of wickets in each over
- dot_balls
number of balls with no runs in an over
- runs_per_over
Runs for each over
- run_rate
run rate for each over
Source
https://www.kaggle.com/josephgpinto/ipl-data-analysis/data
Examples
data(cricket)
library(tsibble)
library(dplyr)
library(ggplot2)
# convert data set to a tsibble ----
cricket_tsibble <- cricket %>%
mutate(data_index = row_number()) %>%
as_tsibble(index = data_index)
# set the hierarchy of the units in a table ----
hierarchy_model <- tibble::tibble(
units = c("index", "over", "inning", "match"),
convert_fct = c(1, 20, 2, 1)
)
# Compute granularities ----
cricket_tsibble %>%
create_gran("over_inning",
hierarchy_model)
# Visualise distribution of runs across granularities ----
cricket_tsibble %>%
filter(batting_team %in% c("Mumbai Indians",
"Chennai Super Kings"))%>%
prob_plot("inning", "over",
hierarchy_model,
response = "runs_per_over",
plot_type = "lv")
[Package gravitas version 0.1.3 Index]