The goal of ipl
is to provide data and functions related to the Indian
Premier League (IPL) matches and standard cricket statistics. This
package allows users to avail of IPL data and conduct analysis of
cricketers and IPL teams using functions of this package.
This is package is important because there isn’t a consolidated database where one can find all the data to analyse past IPL matches and players. These functions will also aid in conducting data analysis for those who are interested in analysing IPL trends.
The ipl
R package consists of datasets on all IPL matches played in
the years 2008-2020, and provides functions to calculate typical
crickets statistics.
Our package includes datasets on IPL matches played and cricketers in the years 2008-2020, acquired primarily from Kaggle, which have been cleaned so users can use it directly for data analysis. Moreover, it comprises functions for analysis of individual cricketers and games, as well as summary statistics for the same.
You can install the development version of ipl
like so:
remotes::install_github("Swaha294/ipl")
#> Downloading GitHub repo Swaha294/ipl@HEAD
#> tibble (3.1.6 -> 3.1.7) [CRAN]
#> ggplot2 (3.3.5 -> 3.3.6) [CRAN]
#> Installing 2 packages: tibble, ggplot2
#>
#> There are binary versions available but the source versions are later:
#> binary source needs_compilation
#> tibble 3.1.6 3.1.7 TRUE
#> ggplot2 3.3.5 3.3.6 FALSE
#> installing the source packages 'tibble', 'ggplot2'
#> * checking for file ‘/private/var/folders/0p/hkwpsbqj047d4nq34kz3_wdr0000gn/T/RtmprsNSua/remotes41121ff051a6/Swaha294-ipl-993c34c/DESCRIPTION’ ... OK
#> * preparing ‘ipl’:
#> * checking DESCRIPTION meta-information ... OK
#> * checking for LF line-endings in source and make files and shell scripts
#> * checking for empty or unneeded directories
#> * building ‘ipl_0.0.0.9000.tar.gz’
deliveries
: Ball-by-ball data of IPL matches played in 2008-2020teams
: Winning team, overs bowled, runs made and wickets fallen
for each match played by each IPL team in 2008-2020ipl
: More information on matches from 2008 to 2020batsman_100
: Information of top 100 batsmen of IPLbowlers_100
: Information of top 100 bowlers of IPLThe following functions allow for individual analyses of cricketers and IPL matches, as well as for combined statistical analysis of the same.
bat_avg
\~ 134,112 Bbat_max
\~ 113,136 Bbatsman_summary
\~ 130,616 Bbowler_score
\~ 81,216 Bbowler_summary
\~ 90,000 Bbowling_analysis
\~ 93,216 Bcents_halfcents
\~ 120,688 Bfours
\~ 87,072 Bovers_balls
\~ 90,600 Bovers
\~ 77,240 Bpartnership_runs
\~ 93,000 Bruns
\~ 76,984 Bsixes
\~ 87,072strike_rate
\~ 118,520 Btoss_choice
\~ 87,016 Bwickets_taken
\~ 77,888 Bwinloss
\~ 120,768 BThese are a few examples of how to use the package to compute different statistics for cricketers and IPL matches
Load ipl
R package
library(ipl)
partnership_runs(1175358, "Mumbai Indians")
batsman_summary("MS Dhoni")
#> year player_runs player_wickets batting_avg max_runs strike_rate centuries
#> 1 2020 200 8 25.00 47 116.28 0
#> 2 2019 416 5 83.20 84 134.63 0
#> 3 2018 455 7 65.00 79 150.66 0
#> 4 2017 290 13 22.31 61 116.00 0
#> 5 2016 284 8 35.50 64 135.24 0
#> 6 2015 372 14 26.57 53 121.97 0
#> 7 2014 371 5 74.20 57 148.40 0
#> 8 2013 461 11 41.91 67 162.90 0
#> 9 2012 358 11 32.55 51 128.78 0
#> 10 2011 392 10 39.20 70 158.70 0
#> 11 2010 287 9 31.89 66 136.67 0
#> 12 2009 332 8 41.50 58 127.20 0
#> 13 2008 414 10 41.40 65 133.55 0
#> half_centuries num_4s num_6s
#> 1 0 16 7
#> 2 3 22 23
#> 3 3 24 30
#> 4 1 15 16
#> 5 1 18 14
#> 6 1 27 17
#> 7 1 22 20
#> 8 4 32 25
#> 9 1 26 9
#> 10 2 25 23
#> 11 2 26 8
#> 12 2 22 9
#> 13 2 38 15
winloss("Sunrisers Hyderabad", 2017)
#> toss_decision wins losses wpct
#> 1 bat 2 0 1.0000000
#> 2 field 6 6 0.5000000
#> 3 total 8 6 0.5714286
bowling_analysis("Rahul Sharma")
#> bowler overs runs wickets_taken
#> 1 Rahul Sharma 154.4 1086 40
More examples can be found in the vignette.