cricket: Cricket data set for different seasons of Indian Premier...

Description Usage Format Source Examples

Description

The Indian Premier League played by teams representing different cities in India from 2008 to 2016.

Usage

1

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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")

Example output

sh: 1: timedatectl: Permission denied
Error in file(con, "r") : cannot open the connection
In addition: Warning messages:
1: In system("timedatectl", intern = TRUE) :
  running command 'timedatectl' had status 126
2: In file(con, "r") : cannot open file '/etc/timezone': Permission denied

Attaching package:dplyrThe following objects are masked frompackage:stats:

    filter, lag

The following objects are masked frompackage:base:

    intersect, setdiff, setequal, union

# A tsibble: 8,560 x 12 [1]
   season match_id batting_team bowling_team inning  over wicket dot_balls
    <dbl>    <dbl> <chr>        <chr>         <dbl> <dbl>  <dbl>     <dbl>
 1   2008        2 Chennai SupKings XI Pu1     1      0         4
 2   2008        2 Chennai SupKings XI Pu1     2      0         2
 3   2008        2 Chennai SupKings XI Pu1     3      1         4
 4   2008        2 Chennai SupKings XI Pu1     4      0         3
 5   2008        2 Chennai SupKings XI Pu1     5      0         3
 6   2008        2 Chennai SupKings XI Pu1     6      0         3
 7   2008        2 Chennai SupKings XI Pu1     7      1         1
 8   2008        2 Chennai SupKings XI Pu1     8      1         3
 9   2008        2 Chennai SupKings XI Pu1     9      0         1
10   2008        2 Chennai SupKings XI Pu1    10      0         2
# … with 8,550 more rows, and 4 more variables: runs_per_over <dbl>,
#   run_rate <dbl>, data_index <int>, over_inning <fct>
Joining, by = c("inning", "over")
Joining, by = c("inning", "over")

gravitas documentation built on July 2, 2020, 4:01 a.m.