GooglyPlusPlus2021:ICC WC T20:Pavilion-view analytics as-it-happens!

This year 2021, we are witnessing a rare spectacle in the cricketing universe, where IPL playoffs are immediately followed by ICC World Cup T20. Cricket pundits have claimed such a phenomenon occurs once in 127 years! Jokes apart, the World cup T20 is underway and as usual GooglyPlusPlus is ready for the action.

GooglyPlusPlus will provide near-real time analytics, by automatically downloading the latest match data daily, processing and organising the match data into appropriate folders so that my R package yorkr can slice and dice the data to provide the pavilion-view analytics.

The charts capture all the breathless, heart-pounding, and nail-biting action in great details in the many tables and plots. Every table and chart tell a story. You just have to ‘read between the lines!’

GooglyPlusPlus2021 will update itself automatically every day, so the data will be current and you can analyse all matches upto the previous day, along with the historical performances of the teams. So make sure you check it everyday.

Note:

  1. All charts are interactive. To know how to use the interactive charts see my post GooglyPlusPlus2021 is now fully interactive!!!
  2. The are 5 tabs for each of the formats supported by GooglyPlusPlus2021 which now supports IPL, Intl. T20(men), Intl. T20(women), BBL, NTB, PSL, CPL, SSM, WBB. Besides, it also supports ODI (men) and ODI (women)
  3. Each of the formats have 5 tabs – Batsman, Bowler, Match, Head-to-head and Overall Performace.
  4. All T20 formats also include a ranking functionality for the batsmen and bowlers
  5. You can now perform drill-down analytics for batsmen, bowlers, head-to-head and overall performance based on date-range selector functionality. The ranking tabs also include date range selector granular analysis. For more details see GooglyPlusPlus2021 enhanced with drill-down batsman, bowler analytics

Try out GooglyPlusPlus2021 here GooglyPlusPlus2021!!

You can clone fork the code from Github gpp2021-8

I am including some random screenshots of things that can be done with GooglyPlusPlus2021

A. Papua New Guinea vs Oman (2021-10-17)

a. Batting partnership

B. Match worm chart (New Papua Guinea v Oman)

This was a no contest as Oman cruised to victory

C. Scotland vs Bangladesh (2021-10-17)

a. Scorland upset Bangladesh

b. March worm chart (Scotland vs Bangladesh)

Fortunes see-sawed one way, then another, as can be seen in the match worm chart

C. Netherlands vs Ireland (2021-10-18)

a. Batman vs Bowler

D. Historical performance head-to-head

a. Sri Lanka vs West Indies (2019-2021) – Batting partnerships

b. India vs England (2018 – 2021) – Bowling scorecard

c) Australia vs South Africa – Team wicket opposition

E) Overall performance

a. Pakistan batting scorecard since 2019

a. Win loss of Australia since 2019

F) Batsman Performance

a. PR Stirling’s runs against opposition since 2019

b. KJ Brien’s cumulative average runs since 2019

G. Bowler performance

a. PWH De Silva’s wicket prediction since 2019

b. T Shamsi’s cumulative average wickets since 2019

H. Ranking Intl. T20 batsman since 2019

a. Runs over Strike rate

b. Strike rate over runs

I. Ranking bowlers since 2019

a. Wickets over Economy rate

b. Economy rate over wickets

As mentioned above GooglyPlusPlus2021 will be updated daily automatically, so you won’t miss any analytic action.

Do give GooglyPlusPlus2021 a spin!

Clone/fork the code for the Shiny app from Github gpp2021-8

You may also like

  1. Natural language processing: What would Shakespeare say?
  2. Literacy in India – A deepR dive
  3. Practical Machine Learning with R and Python – Part 5
  4. Big Data 7: yorkr waltzes with Apache NiFi
  5. Getting started with Tensorflow, Keras in Python and R
  6. Deep Learning from first principles in Python, R and Octave – Part 7
  7. Introducing QCSimulator: A 5-qubit quantum computing simulator in R
  8. Video presentation on Machine Learning, Data Science, NLP and Big Data – Part 1

To see all post click Index of posts

GooglyPlusPlus2021 is now fully interactive!!!

GooglyPlusPlus2021 is now fully interactive. Please read the below post carefully to see the different ways you can interact with the data in the plots.

There are 2 main updates in this latest version of GooglyPlusPlus2021

a) GooglyPlusPlus gets all ‘touchy, feely‘ with the data and now you can interact with the plot/chart to get more details of the underlying data. There are many ways you can slice’n dice the data in the charts. The examples below illustrate a few of this. You can interact with plots by hover’ing, ‘click’ing and ‘double-click’ing curves, plots, barplots to get details of the data.

b) GooglyPlusPlus also includes the ‘Super Smash T20’ league from New Zealand. You can analyze batsmen, bowlers, matches, teams and rank Super Smash (SSM) also

Note: GooglyPlusPlus2021 can handle a total of 11 formats including T20 and ODI. They are

i) IPL ii) Intl. T20(men) ii) Intl. T20(women) iv) BBL

v) NTB vi) PSL vii) WBB. viii) CPL

ix) SSM x) ODI (men) xi) ODI (women)

Each of these formats have 7 tabs which are

— Analyze batsman

— Analyze bowlers

— Analyze match

— Head-to-head

— Team vs all other teams

— Rank batsmen

— Rank bowlers

Within these 11 x 7 = 77 tabs you can analyze batsmen, bowlers, matches, head-to-head, team vs all other teams and rank players for T20 and ODI. In addition all plots have been made interactive so there is a lot more information that you can get from these charts

Try out the interactive GooglyPlusPlus2021 now!!!

You can fork/clone the Shiny app from Github at GooglyPlusPlus2021

Below I have randomly included some charts for different formats to show how you can interact with them

a) Batsman Analysis – Runs vs Deliveries (IPL)

Mouse-over/Hover

The plot below gives the number of runs scored by David Warner vs Deliveries faced.

b) Batsman Analysis – Runs vs Deliveries (IPL) (prediction)

Since a 2nd order regression line,with confidence intervals(shaded area), has been fitted in the above plot, we can predict the runs given the ‘balls faced’ as below

Click ‘Toggle Spike lines’ (use palette on top-right)

By using hover(mouse-over) on the curve we can determine the predicted number of runs Warner will score given a certain number of deliveries

c) Bowler Analysis – Wickets against opposition – Intl. T20 (women)

Jhulan Goswami’s wickets against opposition countries in Intl. T20 (women)

d) Bowler Analysis (Predict bowler wickets) IPL – (non-interactive**)

Note: Some plots are non-interactive, like the one below which predicts the number of wickets Bumrah will take based on number of deliveries bowled

e) Match Analysis – Batsmen Partnership -Intl. T20 (men)

India vs England batting partnership between Virat Kohli & Shikhar Dhawan in all matches between England and India

f) Match Analysis – Worm chart (Super Smash T20) SSM

i) Worm chart of Auckland vs Northern Districts (29 Jan 2021).

ii) The final cross-over happens around the 2nd delivery of the 19th over (18.2) as Northern Districts over-takes Auckland to win the match.

g) Head-to-head – Team batsmen vs bowlers (Bangladesh batsmen against Afghanistan bowlers) Intl. T20 (men)

Batting performance of Shakib-al-Hasan (Bangladesh) against Afghanistan bowlers in Intl. T20 (men)

h) Head-to-head – Team batsmen vs bowlers (Bangladesh batsmen against Afghanistan bowlers) Intl. T20 (men)Filter

Double click on Shakib-al-Hasan on the legend to get the performance of Shakib-al-Hasan against Afghanistan bowlers

Avoiding the clutter

i) Head-to-head – Team bowler vs batsmen (Chennai Super Kings bowlers vs Mumbai Indians batsmen) – IPL

If you choose the above option the resulting plot is very crowded as shown below

To get the performance of Mumbai Indian (MI) batsmen (Rohit Sharma & Kieron Pollard) against Chennai Super Kings (CSK) bowlers in all matches do as told below

Steps to avoid clutter in stacked bar plots

1) This can be avoided by selectively choosing to filter out the batsmen we are interested in. say RG Sharma and Kieron Pollard. Then double-ciick RG Sharma, this is will bring up the chart with only RG Sharma as below

2) Now add additional batsmen you are interested in by single-clicking. In the example below Kieron Pollard is added

You can continue to add additional players that you are interested by single clicking.

j) Head-to-head (Performance of Indian batsmen vs Australian bowlers)- ODI

In the plot V Kohli, MS Dhoni and SC Ganguly have been selected for their performance against Australian bowlers (use toggle spike lines)

k) Overall Performance – PSL batting partnership against all teams (Fakhar Zaman)

The plot below shows Fakhar Zaman (Lahore Qalanders) partnerships with other teammates in all matches in PSL.

l) Win-loss against all teams (CPL)

Win-loss chart of Jamaica Talawallahs (CPL) in all matches against all opposition

m) Team batting partnerships against all teams for India (ODI Women)

Batting partnerships of Indian ODI women against all other teams

n) Ranking of batsmen (IPL 2021)

Finally here is the latest ranking of IPL batsmen for IPL 2021 (can be done for all other T20 formats)

o) Ranking of bowlers (IPL 2021)

Clone/download the Shiny app from Github at GooglyPlusPlus2021

So what are you waiting for? Go ahead and try out GooglyPlusPlus2021!

Knock yourself out!

Enjoy enjaami!!!

See also

  1. Deconstructing Convolutional Neural Networks with Tensorflow and Keras
  2. Deep Learning from first principles in Python, R and Octave – Part 6
  3. Cricketr learns new tricks : Performs fine-grained analysis of players
  4. Big Data 6: The T20 Dance of Apache NiFi and yorkpy
  5. Using Linear Programming (LP) for optimizing bowling change or batting lineup in T20 cricket
  6. Practical Machine Learning with R and Python – Part 6
  7. Introducing QCSimulator: A 5-qubit quantum computing simulator in R
  8. Simulating an oscillating revoluteJoint in Android
  9. Benford’s law meets IPL, Intl. T20 and ODI cricket
  10. De-blurring revisited with Wiener filter using OpenCV

To see all posts click Index of posts

Benford’s law meets IPL, Intl. T20 and ODI cricket

“To grasp how different a million is from a billion, think about it like this: A million seconds is a little under two weeks; a billion seconds is about thirty-two years.”

“One of the pleasures of looking at the world through mathematical eyes is that you can see certain patterns that would otherwise be hidden.”

               Steven Strogatz, Prof at Cornell University

Introduction

Within the last two weeks, I was introduced to Benford’s Law by 2 of my friends. Initially, I looked it up and Google and was quite intrigued by the law. Subsequently another friends asked me to check the ‘Digits’ episode, from the “Connected” series on Netflix by Latif Nasser, which I strongly recommend you watch.

Benford’s Law also called the Newcomb–Benford law, the law of anomalous numbers, or the First Digit Law states that, when dealing with quantities obtained from Nature, the frequency of appearance of each digit in the first significant place is logarithmic. For example, in sets that obey the law, the number 1 appears as the leading significant digit about 30.1% of the time, the number 2 about 17.6%, number 3 about 12.5% all the way to the number 9 at 4.6%. This interesting logarithmic pattern is observed in most natural datasets from population densities, river lengths, heights of skyscrapers, tax returns etc. What is really curious about this law, is that when we measure the lengths of rivers, the law holds perfectly regardless of the units used to measure. So the length of the rivers would obey the law whether we measure in meters, feet, miles etc. There is something almost mystical about this law.

The law has also been used widely to detect financial fraud, manipulations in tax statements, bots in twitter, fake accounts in social networks, image manipulation etc. In this age of deep fakes, the ability to detect fake images will assume paramount importance. While deviations from Benford Law do not always signify fraud, to large extent they point to an aberration. Prof Nigrini, of Cape Town used this law to identify financial discrepancies in Enron’s financial statement resulting in the infamous scandal. Also the 2009 Iranian election was found to be fradulent as the first digit percentages did not conform to those specified by Benford’s Law.

While it cannot be said with absolute certainty, marked deviations from Benford’s law could possibly indicate that there has been manipulation of natural processes. Possibly Benford’s law could be used to detect large scale match-fixing in cricket tournaments. However, we cannot look at this in isolation and the other statistical and forensic methods may be required to determine if there is fraud. Here is an interesting paper Promises and perils of Benford’s law

A set of numbers is said to satisfy Benford’s law if the leading digit d (d ∈ {1, …, 9}) occurs with probability

P(d)=log_{10}(1+1/d)

This law also works for number in other bases, in base b >=2

P(d)=log_{b}(1+1/d)

Interestingly, this law also applies to sports on the number of point scored in basketball etc. I was curious to see if this applied to cricket. Previously, using my R package yorkr, I had already converted all T20 data and ODI data from Cricsheet which is available at yorkrData2020, I wanted to check if Benford’s Law worked on the runs scored, or deliveries faced by batsmen at team level or at a tournament level (IPL, Intl. T20 or ODI).

Thankfully, R has a package benford.analysis to check for data behaviour in accordance to Benford’s Law, and I have used this package in my post

This post is also available in RPubs as Benford’s Law meets IPL, Intl. T20 and ODI

library(data.table)
library(reshape2)
library(dplyr)
library(benford.analysis)
library(yorkr)

In this post, I have randomly check data with Benford’s law. The fully converted dataset is available in yorkrData2020 which I have included above. You can try on any dataset including ODI (men,women),Intl T20(men,women),IPL,BBL,PSL,NTB and WBB.

1. Check the runs distribution by Royal Challengers Bangalore

We can see the behaviour is as expected with Benford’s law, with minor deviations

load("/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/ipl/iplBattingBowlingDetails/Royal Challengers Bangalore-BattingDetails.RData")
rcbRunsTrends = benford(battingDetails$runs, number.of.digits = 1, discrete = T, sign = "positive") 
rcbRunsTrends
## 
## Benford object:
##  
## Data: battingDetails$runs 
## Number of observations used = 1205 
## Number of obs. for second order = 99 
## First digits analysed = 1
## 
## Mantissa: 
## 
##    Statistic  Value
##         Mean  0.458
##          Var  0.091
##  Ex.Kurtosis -1.213
##     Skewness -0.025
## 
## 
## The 5 largest deviations: 
## 
##   digits absolute.diff
## 1      1         14.26
## 2      7         13.88
## 3      9          8.14
## 4      6          5.33
## 5      4          4.78
## 
## Stats:
## 
##  Pearson's Chi-squared test
## 
## data:  battingDetails$runs
## X-squared = 5.2091, df = 8, p-value = 0.735
## 
## 
##  Mantissa Arc Test
## 
## data:  battingDetails$runs
## L2 = 0.0022852, df = 2, p-value = 0.06369
## 
## Mean Absolute Deviation (MAD): 0.004941381
## MAD Conformity - Nigrini (2012): Close conformity
## Distortion Factor: -18.8725
## 
## Remember: Real data will never conform perfectly to Benford's Law. You should not focus on p-values!

2. Check the ‘balls played’ distribution by Royal Challengers Bangalore

load("/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/ipl/iplBattingBowlingDetails/Royal Challengers Bangalore-BattingDetails.RData")
rcbBallsPlayedTrends = benford(battingDetails$ballsPlayed, number.of.digits = 1, discrete = T, sign = "positive") 
plot(rcbBallsPlayedTrends)

 

3. Check the runs distribution by Chennai Super Kings

The trend seems to deviate from the expected behavior to some extent in the number of digits for 5 & 7.

load("/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/ipl/iplBattingBowlingDetails/Chennai Super Kings-BattingDetails.RData")
cskRunsTrends = benford(battingDetails$runs, number.of.digits = 1, discrete = T, sign = "positive") 
cskRunsTrends
## 
## Benford object:
##  
## Data: battingDetails$runs 
## Number of observations used = 1054 
## Number of obs. for second order = 94 
## First digits analysed = 1
## 
## Mantissa: 
## 
##    Statistic  Value
##         Mean  0.466
##          Var  0.081
##  Ex.Kurtosis -1.100
##     Skewness -0.054
## 
## 
## The 5 largest deviations: 
## 
##   digits absolute.diff
## 1      5         27.54
## 2      2         18.40
## 3      1         17.29
## 4      9         14.23
## 5      7         14.12
## 
## Stats:
## 
##  Pearson's Chi-squared test
## 
## data:  battingDetails$runs
## X-squared = 22.862, df = 8, p-value = 0.003545
## 
## 
##  Mantissa Arc Test
## 
## data:  battingDetails$runs
## L2 = 0.002376, df = 2, p-value = 0.08173
## 
## Mean Absolute Deviation (MAD): 0.01309597
## MAD Conformity - Nigrini (2012): Marginally acceptable conformity
## Distortion Factor: -17.90664
## 
## Remember: Real data will never conform perfectly to Benford's Law. You should not focus on p-values!

4. Check runs distribution in all of Indian Premier League (IPL)

battingDF <- NULL
teams <-c("Chennai Super Kings","Deccan Chargers","Delhi Daredevils",
          "Kings XI Punjab", 'Kochi Tuskers Kerala',"Kolkata Knight Riders",
          "Mumbai Indians", "Pune Warriors","Rajasthan Royals",
          "Royal Challengers Bangalore","Sunrisers Hyderabad","Gujarat Lions",
          "Rising Pune Supergiants")


setwd("/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/ipl/iplBattingBowlingDetails")
for(team in teams){
  battingDetails <- NULL
  val <- paste(team,"-BattingDetails.RData",sep="")
  print(val)
  tryCatch(load(val),
           error = function(e) {
             print("No data1")
             setNext=TRUE
           }
           
           
  )
  details <- battingDetails
  battingDF <- rbind(battingDF,details)
}
## [1] "Chennai Super Kings-BattingDetails.RData"
## [1] "Deccan Chargers-BattingDetails.RData"
## [1] "Delhi Daredevils-BattingDetails.RData"
## [1] "Kings XI Punjab-BattingDetails.RData"
## [1] "Kochi Tuskers Kerala-BattingDetails.RData"
## [1] "Kolkata Knight Riders-BattingDetails.RData"
## [1] "Mumbai Indians-BattingDetails.RData"
## [1] "Pune Warriors-BattingDetails.RData"
## [1] "Rajasthan Royals-BattingDetails.RData"
## [1] "Royal Challengers Bangalore-BattingDetails.RData"
## [1] "Sunrisers Hyderabad-BattingDetails.RData"
## [1] "Gujarat Lions-BattingDetails.RData"
## [1] "Rising Pune Supergiants-BattingDetails.RData"
trends = benford(battingDF$runs, number.of.digits = 1, discrete = T, sign = "positive") 
trends
## 
## Benford object:
##  
## Data: battingDF$runs 
## Number of observations used = 10129 
## Number of obs. for second order = 123 
## First digits analysed = 1
## 
## Mantissa: 
## 
##    Statistic   Value
##         Mean  0.4521
##          Var  0.0856
##  Ex.Kurtosis -1.1570
##     Skewness -0.0033
## 
## 
## The 5 largest deviations: 
## 
##   digits absolute.diff
## 1      2        159.37
## 2      9        121.48
## 3      7         93.40
## 4      8         83.12
## 5      1         61.87
## 
## Stats:
## 
##  Pearson's Chi-squared test
## 
## data:  battingDF$runs
## X-squared = 78.166, df = 8, p-value = 1.143e-13
## 
## 
##  Mantissa Arc Test
## 
## data:  battingDF$runs
## L2 = 5.8237e-05, df = 2, p-value = 0.5544
## 
## Mean Absolute Deviation (MAD): 0.006627966
## MAD Conformity - Nigrini (2012): Acceptable conformity
## Distortion Factor: -20.90333
## 
## Remember: Real data will never conform perfectly to Benford's Law. You should not focus on p-values!

5. Check Benford’s law in India matches

setwd("/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/t20/t20BattingBowlingDetails")
load("India-BattingDetails.RData")

indiaTrends = benford(battingDetails$runs, number.of.digits = 1, discrete = T, sign = "positive") 
plot(indiaTrends)

 

6. Check Benford’s law in all of Intl. T20

setwd("/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/t20/t20BattingBowlingDetails")
teams <-c("Australia","India","Pakistan","West Indies", 'Sri Lanka',
          "England", "Bangladesh","Netherlands","Scotland", "Afghanistan",
          "Zimbabwe","Ireland","New Zealand","South Africa","Canada",
          "Bermuda","Kenya","Hong Kong","Nepal","Oman","Papua New Guinea",
          "United Arab Emirates","Namibia","Cayman Islands","Singapore",
          "United States of America","Bhutan","Maldives","Botswana","Nigeria",
          "Denmark","Germany","Jersey","Norway","Qatar","Malaysia","Vanuatu",
          "Thailand")

for(team in teams){
  battingDetails <- NULL
  val <- paste(team,"-BattingDetails.RData",sep="")
  print(val)
  tryCatch(load(val),
           error = function(e) {
             print("No data1")
             setNext=TRUE
           }
           
           
  )
  details <- battingDetails
  battingDF <- rbind(battingDF,details)
  
}
intlT20Trends = benford(battingDF$runs, number.of.digits = 1, discrete = T, sign = "positive") 
intlT20Trends
## 
## Benford object:
##  
## Data: battingDF$runs 
## Number of observations used = 21833 
## Number of obs. for second order = 131 
## First digits analysed = 1
## 
## Mantissa: 
## 
##    Statistic  Value
##         Mean  0.447
##          Var  0.085
##  Ex.Kurtosis -1.158
##     Skewness  0.018
## 
## 
## The 5 largest deviations: 
## 
##   digits absolute.diff
## 1      2        361.40
## 2      9        276.02
## 3      1        264.61
## 4      7        210.14
## 5      8        198.81
## 
## Stats:
## 
##  Pearson's Chi-squared test
## 
## data:  battingDF$runs
## X-squared = 202.29, df = 8, p-value < 2.2e-16
## 
## 
##  Mantissa Arc Test
## 
## data:  battingDF$runs
## L2 = 5.3983e-06, df = 2, p-value = 0.8888
## 
## Mean Absolute Deviation (MAD): 0.007821098
## MAD Conformity - Nigrini (2012): Acceptable conformity
## Distortion Factor: -24.11086
## 
## Remember: Real data will never conform perfectly to Benford's Law. You should not focus on p-values!

Conclusion

Maths rules our lives, more than we are aware, more that we like to admit. It is there in all of nature. Whether it is the recursive patterns of Mandelbrot sets, the intrinsic notion of beauty through the golden ratio, the murmuration of swallows, the synchronous blinking of fireflies or in the almost univerality of Benford’s law on natural datasets, mathematics govern us.

Isn’t it strange that while we humans pride ourselves of freewill, the runs scored by batsmen in particular formats conform to Benford’s rule for the first digits. It almost looks like, the runs that will be scored is almost to extent predetermined to fall within specified ranges obeying Benford’s law. So much for choice.

Something to be pondered over!

Also see

  1. Introducing GooglyPlusPlus!!!
  2. Deconstructing Convolutional Neural Networks with Tensorflow and Keras
  3. Going deeper into IBM’s Quantum Experience!
  4. Experiments with deblurring using OpenCV
  5. Big Data 6: The T20 Dance of Apache NiFi and yorkpy
  6. Deep Learning from first principles in Python, R and Octave – Part 4
  7. Practical Machine Learning with R and Python – Part 4
  8. Re-introducing cricketr! : An R package to analyze performances of cricketers
  9. Bull in a china shop – Behind the scenes in Android

Introducing GooglyPlusPlus!!!

“We can lift ourselves out of ignorance, we can find ourselves as creatures of excellence and intelligence and skill.”
“Heaven is not a place, and it is not a time. Heaven is being perfect.”
“Your whole body, from wingtip to wingtip, is nothing more than your thought itself, in a form you can see. Break the chains of your thought, and you break the chains of your body, too.”

From Jonathan Livingstone Seagull, by Richard Bach

Introduction

The metamorphosis is complete, from eggs to the butterfly! My R package yorkr, went on to become Googly,  and then to GooglyPlus and  now finally GooglyPlusPlus. My latest R Shiny app now provides interactive visualisation of almost all data in Cricsheet. GooglyPlusPlus visualizes the following matches

1. ODI (men)
2. ODI (women)
3. Intl. T20 (men)
4. Intl T20 (women)
5. IPL (Indian Premier League)
6. BBL (Big Bash League)
7. NTB (Natwest T20)
8. PSL (Pakistan Super League)
9. WBBL – Women’s BBL

GooglyPlusPlus is entirely based on my R package yorkr. To know more about yorkr see ‘Revitalizing R package yorkr‘ and the roughly 25+ posts on yorkr in Index of posts

This Shiny app was quite involved, and it took a lot of work to keep things organised and separate for the different forms of cricket. Anyway it is done and I am happy with the outcome.

Before you use the app, I would suggest that you take a look at the video “How to use GooglyPlusPlus?“. In this video, I show the different features of GooglyPlusPlus and how to navigate through them.

Check out GooglyPlusPlus Shiny at GooglyPlusPlus

You can clone/fork and play around with the code of GooglyPlusPlus here at Github

A. Highlights of GooglyPlusPlus.

The R Shiny app GooglyPlusPlus has the following main pages for the 9 different cricket formats. See below

 

Important note: Below I will be including some random output from the GooglyPlusPlus app for different match formats, however there is a lot more features in GooglyPlusPlus

1.  Indian Premier League (IPL)

a. IPL batsman – Batsman Runs vs Deliveries

 

b. IPL Match – Match  batting scorecard

 

c. Head-to-head between 2 IPL Teams – Team Batsmen Batting Partnership All Matches

 

 

 

d. Overall Performance – Team Bowling Scorecard Overall

 

 

 

2. International T20 Men

a. Batsman Function- Runs vs Strike rate

 

 

 

b. Bowler Function – Mean Economy Rate

 

 

3. International T20 (Women)

a.Batsman Functions – Batsman Cumulative Average Runs

 

 

b. Intl T20 Women’s match – Match worm Graph

 

 

 

 

 

4. Big Bash League (BBL)

a.Head-to-Head: Team batsmen batting partnerships

 

b.  Overall Performance – Team batsmen vs bowlers

 

 

5. Natwest T20 (NTB)

a. Head-to-head : Team bowlers vs batsmen

 

 

 

b. Batsman Runs vs Deliveries

 

 

6. Pakistan Super League (PSL)

a. Overall Performance – Batsmen Partnership

 

b. Bowling Scorecard

 

7. Women’s Big Bash League (WBBL)

a. Bowler wicket against opposition

 

 

8. One Day International (ODI) Men

a. Batsman Runs Against Opposition

 

b. Team Batsmen against bowlers

 

 

9. One Day International (ODI) women)

a. Match Batting Scorecard

b. Batsman Cumulative Strike Rate

 

 

 

Conclusion

There you have it. I have randomly shown  2 functions for each cricket format. There are many functions in each tab for the for the different match formats – namely IPL, BBL, Intl T20 (men,women), PSL etc.  Go ahead and give GooglyPlusPlus a spin!

To try out GooglyPlusPlus click GooglyPlusPlus. Don’t forget to check out the video How to use GooglyPlusPlus?

You can clone/fork the code from Github at GooglyPlusPlus

Hope you have fun with GooglyPlusPlus!!

You may also like

1. Big Data 6: The T20 Dance of Apache NiFi and yorkpy
2. Deep Learning from first principles in Python, R and Octave – Part 7
3. De-blurring revisited with Wiener filter using OpenCV
4. Exploring Quantum Gate operations with QCSimulator
5. Latency, throughput implications for the Cloud
6. Programming Zen and now – Some essential tips-2
7. The Anomaly
8. Practical Machine Learning with R and Python – Part 3
9. Introducing cricpy:A python package to analyze performances of cricketers
10. The making of Total Control Android game

To see all posts click Index of posts

It’s a wrap! yorkr wraps up BBL, NTB, PSL and WBB!!!

“Do not take life too seriously. You will never get out of it alive.” – Elbert Hubbard

“How many people here have telekenetic powers? Raise my hand.” – Emo Philips

Have you ever noticed that anybody driving slower than you is an idiot, and anyone going faster than you is a maniac?” – George Carlin

 

It’s a wrap!!! In my previous posts,Revitalizing yorkr, I showed how you can use yorkr functions for Intl. ODI, Intl. T20 and IPL. My next post yorkr rocks women’s ODI and women’s Intl T20 yorkr handled women’s ODI and Intl. T20. In this post, yorkr wraps the remaining T20 formats namely

  1. Big Bash League (BBL)
  2. Natwest Super T20 (NTB)
  3. Pakistan Super League (PSL)
  4. Women’s Big Bash League (WBB)

The data for all the above T20 formats are taken from Cricsheet.

-All the data has been converted and is available in Github at yorkrData2020 organized as below. You can use any of the 90+ yorkr functions on the converted data.

Screenshot 2020-05-16 at 12.32.07 PM

-This post has been published at RPubs at yorkrWrapUpT20formats

-You can download a PDF version of this file at yorkrWrapsUpT20Formats

  • For ODI Matches men’s and women’ use
  1. ODI-Part1, 2. ODI-Part2,3. ODI-Part3, 4.ODI-Part 4
  • For any of the T20s formats you can use the following posts
  1. T20-Part1, 2. T20-Part2, 3. T20-Part3, 4. T20-Part4

or you can use these templates Intl. T20, or similar to IPL T20

I am going to randomly pick 2 yorkr functions for each of the T20 formats BBL, NTB, PSL and WBB to demonstrate yorkr below, however you can use any of the 90+ yorkr functions

install.packages("../../../yorkrgit/yorkr_0.0.9.tar.gz",repos = NULL, type="source")
library(yorkr)
library(dplyr)

Note: In the following T20 formats I have randomly picked 2 of the 90+ yorkr functions

A. Big Bash League (BBL)

A1.Batting Scorecard

load("../../../yorkrData2020/bbl/bblMatches/Adelaide Strikers-Brisbane Heat-2017-12-31.RData")
as_bh <- overs
teamBattingScorecardMatch(as_bh,'Adelaide Strikers')
## Total= 139
## # A tibble: 9 x 5
##   batsman      ballsPlayed fours sixes  runs
##   <chr>              <int> <dbl> <dbl> <dbl>
## 1 AT Carey               6     0     0     2
## 2 CA Ingram             21     2     0    23
## 3 J Weatherald          14     2     1    20
## 4 JS Lehmann            17     3     0    22
## 5 JW Wells              13     1     0    12
## 6 MG Neser              25     3     2    40
## 7 PM Siddle              1     0     0     1
## 8 Rashid Khan            2     0     1     6
## 9 TM Head               17     0     0    13

A2.Batting Partnership

load("../../../yorkrData2020/bbl/bblMatches2Teams/Melbourne Renegades-Sydney Sixers-allMatches.RData")
mr_ss_matches <- matches
m <-teamBatsmenPartnershiOppnAllMatches(mr_ss_matches,'Sydney Sixers',report="summary")
m
## # A tibble: 28 x 2
##    batsman      totalRuns
##    <chr>            <dbl>
##  1 MC Henriques       277
##  2 JR Philippe        186
##  3 NJ Maddinson       183
##  4 MJ Lumb            165
##  5 DP Hughes          158
##  6 JC Silk            141
##  7 SPD Smith          116
##  8 JM Vince            97
##  9 TK Curran           68
## 10 J Botha             33
## # … with 18 more rows

B. Natwest Super League

B1.Team Match Partnership

load("../../../yorkrData2020/ntb/ntbMatches/Derbyshire-Nottinghamshire-2019-07-26.RData")
db_nt <-overs
teamBatsmenPartnershipMatch(db_nt,"Derbyshire","Nottinghamshire")

B2.Batsmen vs Bowlers

load("../../../yorkrData2020/ntb/ntbMatches2Teams/Birmingham Bears-Leicestershire-allMatches.RData")
bb_le_matches <- matches
teamBatsmenVsBowlersOppnAllMatches(bb_le_matches,"Birmingham Bears","Leicestershire",top=3)

C. Pakistan Super League (PSL)

C1.Individual performance of Babar Azam

library(grid)
library(gridExtra)

babar <- getBatsmanDetails(team="Karachi Kings",name="Babar Azam",dir="../../../yorkrData2020/psl/pslBattingBowlingDetails/")
## [1] "../../../yorkrData2020/psl/pslBattingBowlingDetails//Karachi Kings-BattingDetails.RData"
print(dim(babar))
## [1] 40 15
p1 <-batsmanRunsVsStrikeRate(babar,"Babar Azam")
p2 <-batsmanMovingAverage(babar,"Babar Azam")
p3 <- batsmanCumulativeAverageRuns(babar,"Babar Azam")
grid.arrange(p1,p2,p3, ncol=2)

C2.Bowling performance against all oppositions

load("../../../yorkrData2020/psl/pslMatches2Teams/Lahore Qalandars-Multan Sultans-allMatches.RData")
lq_ms_matches <- matches
teamBowlingPerfOppnAllMatches(lq_ms_matches,"Lahore Qalanders","Multan Sultans")
## # A tibble: 40 x 5
##    bowler              overs maidens  runs wickets
##    <chr>               <int>   <int> <dbl>   <dbl>
##  1 Shaheen Shah Afridi    11       1   134      11
##  2 Junaid Khan             5       0   154       8
##  3 Imran Tahir             5       0    74       6
##  4 Mohammad Ilyas          5       0    93       4
##  5 Haris Rauf              7       0   154       3
##  6 D Wiese                 7       0    92       3
##  7 Mohammad Irfan          5       0    91       3
##  8 S Lamichhane            5       0    74       3
##  9 SP Narine               8       0    48       3
## 10 MM Ali                  3       0    30       3
## # … with 30 more rows

D. Women Big Bash League

D1.Bowling scorecard

load("../../../yorkrData2020/wbb/wbbMatches/Hobart Hurricanes-Brisbane Heat-2018-12-30.RData")
hh_bh_match <- overs
teamBowlingScorecardMatch(hh_bh_match,'Brisbane Heat')
## # A tibble: 6 x 5
##   bowler      overs maidens  runs wickets
##   <chr>       <int>   <int> <dbl>   <dbl>
## 1 DM Kimmince     3       0    31       2
## 2 GM Harris       4       0    23       3
## 3 H Birkett       1       0     7       0
## 4 JL Barsby       3       0    21       0
## 5 JL Jonassen     4       0    33       0
## 6 SJ Johnson      4       0    17       0

D2.Team batsmen partnerships

load("../../../yorkrData2020/wbb/wbbAllMatchesAllTeams/allMatchesAllOpposition-Perth Scorchers.RData")
ps_matches <- matches
teamBatsmenPartnershipAllOppnAllMatchesPlot(ps_matches,"Perth Scorchers",main="Perth Scorchers")

As mentioned above, I have randomly picked 2 yorkr functions for each of the T20 formats. You can use any of the 90+ functions for analysis of matches, teams, batsmen and bowlers.

1a. Ranking Big Bash League (BBL) batsman

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/bbl/bblMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/bbl/bblBattingBowlingDetails"
rankBBLBatsmen(dir=dir,odir=odir,minMatches=30)
## # A tibble: 62 x 4
##    batsman      matches meanRuns meanSR
##    <chr>          <int>    <dbl>  <dbl>
##  1 DJM Short         44     41.6   126.
##  2 SE Marsh          48     39.1   120.
##  3 AJ Finch          60     36.0   130.
##  4 AT Carey          36     35.9   129.
##  5 KP Pietersen      31     33.5   118.
##  6 UT Khawaja        40     31.5   112.
##  7 BJ Hodge          38     31.5   127.
##  8 CA Lynn           72     31.3   128.
##  9 MP Stoinis        53     30.7   112.
## 10 TM Head           45     30     131.
## # … with 52 more rows

1b. Ranking Big Bash League (BBL) bowlers

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/bbl/bblMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/bbl/bblBattingBowlingDetails"
rankBBLBowlers(dir=dir,odir=odir,minMatches=25)
## # A tibble: 53 x 4
##    bowler         matches totalWickets meanER
##    <chr>            <int>        <dbl>  <dbl>
##  1 SA Abbott           60           90   8.42
##  2 AJ Tye              45           69   7.32
##  3 B Laughlin          48           66   7.96
##  4 BCJ Cutting         71           63   8.87
##  5 BJ Dwarshuis        54           62   7.87
##  6 MG Neser            54           57   8.36
##  7 Rashid Khan         40           55   6.32
##  8 JP Behrendorff      41           53   6.55
##  9 SNJ O'Keefe         53           52   6.76
## 10 A Zampa             42           51   7.34
## # … with 43 more rows

2a. Ranking Natwest T20 League (NTB) batsman

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/ntb/ntbMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/ntb/ntbBattingBowlingDetails"

rankNTBBatsmen(dir=dir,odir=odir,minMatches=20)
## # A tibble: 42 x 4
##    batsman          matches meanRuns meanSR
##    <chr>              <int>    <dbl>  <dbl>
##  1 SR Hain               24     34.6   107.
##  2 M Klinger             26     34.1   118.
##  3 MH Wessels            26     33.9   122.
##  4 DJ Bell-Drummond      21     33.1   112.
##  5 DJ Malan              26     33     129.
##  6 T Kohler-Cadmore      23     33.0   118.
##  7 A Lyth                22     31.4   150.
##  8 JJ Cobb               26     30.7   110.
##  9 CA Ingram             25     30.5   153.
## 10 IA Cockbain           26     29.8   121.
## # … with 32 more rows

2b. Ranking Natwest T20 League (NTB) bowlers

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/ntb/ntbMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/ntb/ntbBattingBowlingDetails"

rankNTBBowlers(dir=dir,odir=odir,minMatches=20)
## # A tibble: 23 x 4
##    bowler          matches totalWickets meanER
##    <chr>             <int>        <dbl>  <dbl>
##  1 HF Gurney            23           45   8.63
##  2 AJ Tye               26           40   7.81
##  3 TS Roland-Jones      26           37   8.10
##  4 BAC Howell           20           35   6.89
##  5 TT Bresnan           21           31   8.82
##  6 MJJ Critchley        25           31   7.33
##  7 LA Dawson            24           30   6.80
##  8 TK Curran            23           28   8.19
##  9 NA Sowter            25           28   8.09
## 10 MTC Waller           25           27   7.59
## # … with 13 more rows

3a. Ranking Pakistan Super League (PSL) batsman

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/psl/pslMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/psl/pslBattingBowlingDetails"

rankPSLBatsmen(dir=dir,odir=odir,minMatches=15)
## # A tibble: 47 x 4
##    batsman      matches meanRuns meanSR
##    <chr>          <int>    <dbl>  <dbl>
##  1 Babar Azam        40     33.7   102.
##  2 L Ronchi          31     32.9   143.
##  3 DR Smith          24     30.8   111.
##  4 JJ Roy            15     30.6   123.
##  5 Kamran Akmal      46     30.1   112.
##  6 SR Watson         40     29.2   126.
##  7 Shoaib Malik      35     28.1   113.
##  8 Fakhar Zaman      38     27.6   119.
##  9 Imam-ul-Haq       15     27.4   115.
## 10 RR Rossouw        36     27.0   130.
## # … with 37 more rows

3b. Ranking Pakistan Super League (PSL) bowlers

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/psl/pslMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/psl/pslBattingBowlingDetails"

rankPSLBowlers(dir=dir,odir=odir,minMatches=15)
## # A tibble: 25 x 4
##    bowler              matches totalWickets meanER
##    <chr>                 <int>        <dbl>  <dbl>
##  1 Wahab Riaz               44           70   6.94
##  2 Hasan Ali                41           61   7.43
##  3 Faheem Ashraf            30           50   7.84
##  4 Mohammad Amir            38           48   7.16
##  5 Usman Shinwari           26           43   8.64
##  6 Mohammad Sami            29           40   7.60
##  7 Shadab Khan              40           38   7.57
##  8 Shaheen Shah Afridi      24           34   7.88
##  9 Rumman Raees             24           33   7.77
## 10 Mohammad Hasnain         16           28   8.65
## # … with 15 more rows

4a. Ranking Women’s Big Bash League (WBB) batsman

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/wbb/wbbMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/wbb/wbbBattingBowlingDetails"
rankWBBBatsmen(dir=dir,odir=odir,minMatches=15)
## # A tibble: 36 x 4
##    batsman    matches meanRuns meanSR
##    <chr>        <int>    <dbl>  <dbl>
##  1 BL Mooney       27     46.7  129. 
##  2 SFM Devine      22     43.5  111. 
##  3 EA Perry        16     41.1   97.1
##  4 MM Lanning      19     38     98.2
##  5 JE Cameron      22     32.9  127. 
##  6 DN Wyatt        24     32    112. 
##  7 AE Jones        17     28.9  107. 
##  8 AJ Healy        19     28.4  122. 
##  9 M du Preez      19     27    101. 
## 10 L Lee           18     26.9   98.9
## # … with 26 more rows

4b. Ranking Women’s Big Bash League (WBB) bowlers

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/wbb/wbbMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/wbb/wbbBattingBowlingDetails"
rankWBBBowlers(dir=dir,odir=odir,minMatches=15)
## # A tibble: 31 x 4
##    bowler      matches totalWickets meanER
##    <chr>         <int>        <dbl>  <dbl>
##  1 M Strano         23           37   7.25
##  2 DM Kimmince      24           36   7.46
##  3 SJ Coyte         22           29   7.59
##  4 JL Jonassen      24           28   6.81
##  5 SJ Johnson       24           27   6.61
##  6 ML Schutt        22           26   6.03
##  7 SFM Devine       22           24   7.58
##  8 M Brown          23           23   7.33
##  9 M Kapp           19           23   5.05
## 10 H Graham         19           22   7.68
## # … with 21 more rows

Conclusion

yorkr can handle ODI and T20 matches in the format as represented in Cricsheet. In my posts, I have shown how yorkr can be used for Intl. ODI and Intl. T20 for both men and women. yorkr can also handle all T20 formats like IPL T20, BBL, Natwest T20, PSL and women’s BBL. Go ahead take yorkr for a ride and check out your favorite teams and players.

Hope you have fun!!!

You may also like

  1. Getting started with Tensorflow, Keras in Python and R
  2. Computer Vision: Ramblings on derivatives, histograms and contours
  3. Cricpy adds team analytics to its arsenal!!
  4. Sixer – R package cricketr’s new Shiny avatar
  5. Big Data-2: Move into the big league:Graduate from R to SparkR
  6. Practical Machine Learning with R and Python – Part 5
  7. Deep Learning from first principles in Python, R and Octave – Part 7
  8. Exploring Quantum Gate operations with QCSimulator
  9. GooglyPlus: yorkr analyzes IPL players, teams, matches with plots and tables

To see all posts click Index of Posts

yorkr rocks women’s One Day International (ODI) and International T20!!

“Life is not measured by the number of breaths we take, but by the moments that take our breath away.” Maya Angelou

“Life shrinks or expands in proportion to one’s courage.” Anais Nin

“Devotion to the truth is the hallmark of morality; there is no greater, nobler, more heroic form of devotion than the act of a man who assumes the responsibility of thinking.” Ayn Rand in Atlas Shrugged

Introduction

yorkr, this time, rocks women’s cricket!!! In this post, my R package yorkr analyzes women’s One Day International and International T20. The latest changes in my R package yorkr, as mentioned in my last post Revitalizing R package yorkr, included the modifications for the segregation men’s and women’s ODI and T20 matches into separate folders while converting them from YAML to R data frames. As the data was already converted I could just use the yorkr functions 90+ to analyze the women’s ODI and women’s T20. The data for this is taken from Cricsheet

My R package yorkr has 4 classes of functions

ODI Functions

  • Class 1: Analysis of ODI matches – See ODI-Part 1
  • Class 2: Analysis of all ODI matches between 2 ODI teams – See ODI Part 2
  • Class 3 : Analysis of all matches played by a ODI team againsta all other ODI teams – See ODI Part 3
  • Class 4 : Analysis of ODI batsmen and bowlers – See ODI Part 4

Note
-The converted data is available at yorkrData
-This RMarkdown file has been published at RPubs at yorkrAnalyzesWomensODIT20
-You can download this as a PDF at yorkrAnalyzesWomensODIT20

install.packages("../../../yorkrgit/yorkr_0.0.9.tar.gz",repos = NULL, type="source")

1. Analysis of women’s ODI matches

library(yorkr)

Save all matches between 2 teams

#saveAllMatchesBetweenTeams("../../../yorkrData2020/odi/odiWomenMatches/","../../../yorkrData2020/odi/odiWomenMatches2Teams/")

Save all matches played by an ODI team against all other ODI teams

#saveAllMatchesAllOpposition("../../../yorkrData2020/odi/odiWomenMatches/","../../../yorkrData2020/odi/odiWomenAllMatchesAllTeams/")

Since there are several functions in each class, I have randomly selected a few functions to demonstrate yorkr’s analysis ## ODI Match Analysis (Class 1) In the functions below ODI women matches are analyzed as in the India-Australia ODI in 7 Feb 2016.

1.Scorecard

load("../../../yorkrData2020/odi/odiWomenMatches/Australia-India-2016-02-07.RData")
aus_ind <- overs
teamBattingScorecardMatch(aus_ind,'India')
## Total= 223
## # A tibble: 7 x 5
##   batsman         ballsPlayed fours sixes  runs
##   <chr>                 <int> <int> <dbl> <dbl>
## 1 H Kaur                   42     2     0    22
## 2 J Goswami                 4     1     0     4
## 3 M Raj                   113    12     0    89
## 4 PG Raut                  31     2     0    24
## 5 S Mandhana               52     7     0    55
## 6 S Pandey                 18     2     0    17
## 7 V Krishnamurthy          21     2     0    12

2.Batting Partnerships

The partnerships in this match between India and Australia. Mithali Raj tops the list, with partnerships with Smriti Mandhana, Harmanpreet Kaur and Punam Raut. The next highest partnership is Smriti Mandhana

teamBatsmenPartnershipMatch(aus_ind,"India","Australia")

Analyze bowling in the women’s ODI England-New Zealand match on 15 Feb 2013

3.Wicket kind

load("../../../yorkrData2020/odi/odiWomenMatches/England-New Zealand-2013-02-15.RData")
eng_nz <- overs
teamBowlingWicketKindMatch(eng_nz,"England","New Zealand")

4.Match worm graph

Plot the match worm graph for Pakistan-South Africa women’s ODI 25 Jun 2017

load("../../../yorkrData2020/odi/odiWomenMatches/Pakistan-South Africa-2017-06-25.RData")
pak_sa <-overs
matchWormGraph(pak_sa,'Pakistan',"South Africa")

Analysis of team in all matches against another team (Class 2)

5. Team Batsmen partnerships

The functions below analyze all matches between South Africa and Sri Lanka.

load("../../../yorkrData2020/odi/odiWomenMatches2Teams/South Africa-Sri Lanka-allMatches.RData")
sa_sl_matches <- matches
m <-teamBatsmenPartnershiOppnAllMatches(sa_sl_matches,'South Africa',report="summary")
m
## # A tibble: 16 x 2
##    batsman        totalRuns
##    <chr>              <dbl>
##  1 M du Preez           241
##  2 M Kapp               194
##  3 L Wolvaardt          168
##  4 D van Niekerk        138
##  5 L Lee                138
##  6 T Chetty             136
##  7 A Steyn              118
##  8 L Goodall             89
##  9 S Luus                71
## 10 N de Klerk            35
## 11 CL Tryon              15
## 12 F Tunnicliffe         15
## 13 S Ismail               9
## 14 M Klaas                2
## 15 Y Fourie               1
## 16 B Bezuidenhout         0
teamBatsmenPartnershipOppnAllMatchesChart(sa_sl_matches,"Sri Lanka","South Africa")

6. Team bowler wicketkind

The plot below gives the performance if women Indian ODI bowlers in all ODI matches against England. The top wicket takers are Jhulan Goswami, Ekta Bisht, Gouher Sultana

load("../../../yorkrData2020/odi/odiWomenMatches2Teams/India-England-allMatches.RData")
ind_eng_matches <- matches
teamBowlersWicketsOppnAllMatches(ind_eng_matches,"India","England")

Performance of women ODI teams against all other teams in all matches (Class 3)

7. Overall batting scorecard

West Indies top scorers in ODI in all matches. The top scorers in West Indies are 1. Stafanie Taylor 2. Deandra Dottin 3. Hayley Matthews

load("../../../yorkrData2020/odi/odiWomenAllMatchesAllteams/allMatchesAllOpposition-West Indies.RData")
wi_matches <- matches
m <-teamBattingScorecardAllOppnAllMatches(wi_matches,theTeam="West Indies")
## Total= 4629
m
## # A tibble: 31 x 5
##    batsman          ballsPlayed fours sixes  runs
##    <chr>                  <int> <int> <int> <dbl>
##  1 SR Taylor               1087    83     7   766
##  2 DJS Dottin               778    69    21   641
##  3 HK Matthews              734    71     4   527
##  4 SA Campbelle             649    39     4   396
##  5 Kycia A Knight           517    35     2   284
##  6 CN Nation                554    31     1   274
##  7 Kyshona A Knight         578    35    NA   264
##  8 MR Aguilleira            481    20     3   252
##  9 B Cooper                 289    19     3   176
## 10 NY McLean                230    18     2   155
## # … with 21 more rows

Individual batsman and bowler performances (Class 4)

8. Batsmen performances

The functions below perform individual batsman and bowler analysis. I chose the top women ODI batsman

  1. Mithali Raj (Ind) has the highest ODI runs with a career average of 50.64
  2. Charlotte Edwards (Eng)
  3. Suzie Bates (NX)
#india_details <- getTeamBattingDetails("India",dir="../../../yorkrData2020/odi/odiWomenMatches", save=TRUE,odir="../../../yorkrData2020/odi/odiWomenBattingBowlingDetails")
#eng_details <- getTeamBattingDetails("England",dir="../../../yorkrData2020/odi/odiWomenMatches", save=TRUE,odir="../../../yorkrData2020/odi/odiWomenBattingBowlingDetails")
#nz_details <- getTeamBattingDetails("New Zealand",dir="../../../yorkrData2020/odi/odiWomenMatches", save=TRUE,odir="../../../yorkrData2020/odi/odiWomenBattingBowlingDetails")

mithali <- getBatsmanDetails(team="India",name="M Raj",dir="../../../yorkrData2020/odi/odiWomenBattingBowlingDetails")
## [1] "../../../yorkrData2020/odi/odiWomenBattingBowlingDetails/India-BattingDetails.RData"
charlotte <- getBatsmanDetails(team="England",name="CM Edwards",dir="../../../yorkrData2020/odi/odiWomenBattingBowlingDetails")
## [1] "../../../yorkrData2020/odi/odiWomenBattingBowlingDetails/England-BattingDetails.RData"
suzie<- getBatsmanDetails(team="New Zealand",name="SW Bates",dir="../../../yorkrData2020/odi/odiWomenBattingBowlingDetails")
## [1] "../../../yorkrData2020/odi/odiWomenBattingBowlingDetails/New Zealand-BattingDetails.RData"

Plot Runs vs Strike Rate

library(grid)
library(gridExtra)
p1 <-batsmanRunsVsStrikeRate(mithali,"Mithali Raj")
p2 <- batsmanRunsVsStrikeRate(charlotte, "Charlotte E")
p3 <- batsmanRunsVsStrikeRate(suzie, "Suzie Bates")
grid.arrange(p1,p2,p3, ncol=2)

Plot the moving average

p1 <-batsmanMovingAverage(mithali,"Mithali Raj")
p2 <- batsmanMovingAverage(charlotte, "Charlotte E")
p3 <- batsmanMovingAverage(suzie, "Suzie Bates")
grid.arrange(p1,p2,p3, ncol=2)

p1 <-batsmanCumulativeAverageRuns(mithali,"Mithali Raj")
p2 <- batsmanCumulativeAverageRuns(charlotte, "Charlotte E")
p3 <- batsmanCumulativeAverageRuns(suzie, "Suzie Bates")
grid.arrange(p1,p2,p3, ncol=2)

Analyze ODI bowler performances

9. Bowler performances

The following 3 bowlers have been chosen for analysis

  1. Jhulan Goswami (Ind) is the highest overwall wicket taker with 225 wicket
  2. Anisa Mohammed (WI)
  3. Sana Mir (Pak)
#india_details <- getTeamBowlingDetails("India",dir="../../../yorkrData2020/odi/odiWomenMatches", save=TRUE,odir="../../../yorkrData2020/odi/odiWomenBattingBowlingDetails")
#wi_details <- getTeamBowlingDetails("West Indies",dir="../../../yorkrData2020/odi/odiWomenMatches", save=TRUE,odir="../../../yorkrData2020/odi/odiWomenBattingBowlingDetails")
#pak_details <- getTeamBowlingDetails("Pakistan",dir="../../../yorkrData2020/odi/odiWomenMatches", save=TRUE,odir="../../../yorkrData2020/odi/odiWomenBattingBowlingDetails")

jhulan <- getBowlerWicketDetails(team="India",name="J Goswami",dir="../../../yorkrData2020/odi/odiWomenBattingBowlingDetails")
anisa <- getBowlerWicketDetails(team="West Indies",name="A Mohammed",dir="../../../yorkrData2020/odi/odiWomenBattingBowlingDetails")
sana <- getBowlerWicketDetails(team="Pakistan",name="Sana Mir",dir="../../../yorkrData2020/odi/odiWomenBattingBowlingDetails")

Plot the bowler Mean Economy Rate

p1<-bowlerMeanEconomyRate(jhulan,"Jhulan G")
p2<-bowlerMeanEconomyRate(anisa, "Anisa M")
p3<-bowlerMeanEconomyRate(sana, "Sana Mir")
grid.arrange(p1,p2,p3, ncol=2)

Plot the cumulative average wickets taken by the bowlers

p1<-bowlerCumulativeAvgWickets(jhulan,"Jhulan G")
p2<-bowlerCumulativeAvgWickets(anisa, "Anisa M")
p3<-bowlerCumulativeAvgWickets(sana, "Sana Mir")
grid.arrange(p1,p2,p3, ncol=2)

2. Analysis of women’s International Twenty 20 matches

I have chosen some random yorkr functions to show the analysis of T20 players and matches

T20 Functions

There are the following class of T20 functions

  • Class 1: Analysis of T20 matches – See T20-Part 1
  • Class 2: Analysis of all T20 matches between 2 T20 teams – See T20 Part 2
  • Class 3 : Analysis of all matches played by a T20 team againsta All other T20 teams – See T20 Part 3
  • Class 4 : Analysis of T20 batsmen and bowlers – See T20 Part 4

You can also refer to the yorkr template that I created Analysis of International T20 matches with yorkr templates

Save all matches between teams

#saveAllMatchesBetweenTeams("../../../yorkrData2020/t20/t20WomenMatches/","../../../yorkrData2020/t20/t20WomenMatches2Teams/")

Save all T20 matches played by a team against all other teams

#saveAllMatchesAllOpposition("../../../yorkrData2020/t20/t20WomenMatches/","../../../yorkrData2020/t20/t20WomenAllMatchesAllTeams/")

T20 Match Analysis (Class 1)

10. Batting scorecard

Print the scorecard for the Bangladesh- Ireland match played on 3 Apr 2014

load("../../../yorkrData2020/t20/t20WomenMatches/Bangladesh-Ireland-2014-04-03.RData")
ban_ire <- overs
teamBattingScorecardMatch(ban_ire,'Bangladesh')
## Total= 95
## # A tibble: 9 x 5
##   batsman         ballsPlayed fours sixes  runs
##   <chr>                 <int> <dbl> <dbl> <dbl>
## 1 Ayasha Rahman            19     2     0    12
## 2 Fahima Khatun             2     0     0     0
## 3 Lata Mondal              12     1     0     8
## 4 Panna Ghosh               3     0     0     4
## 5 Rumana Ahmed             14     3     0    16
## 6 Salma Khatun              6     1     0     7
## 7 Shaila Sharmin            7     0     0     6
## 8 Shamima Sultana          11     0     0     7
## 9 Sharmin Akhter           46     3     0    35

Plot the performance of T20 batsmen against in bowlers in Germany – Netherlands.

load("../../../yorkrData2020/t20/t20WomenMatches/Germany-Netherlands-2019-06-27.RData")
ger_net <- overs
teamBatsmenVsBowlersMatch(ger_net,'Netherlands',"Germany",plot=TRUE)

11. Bowling scorecard

Print the bowling scorecard of Hong Kong-Kuwait T20 match played on 25 Feb 2019

load("../../../yorkrData2020/t20/t20WomenMatches/Hong Kong-Kuwait-2019-02-25.RData")
hk_kuw <-overs
teamBowlingScorecardMatch(hk_kuw,'Hong Kong')
## # A tibble: 5 x 5
##   bowler      overs maidens  runs wickets
##   <chr>       <int>   <int> <dbl>   <int>
## 1 Chan Ka Man     2       0     5       1
## 2 KY Chan         3       1     2       4
## 3 M Hill          2       0     6       1
## 4 M Wai Siu       2       0    11       1
## 5 M Yousaf        1       1     0       3

Head to head between 2 women’s T20 teams (Class 2)

12. Team batting partnerships

Print the partnership among Indian T20 women in all matches against England

load("../../../yorkrData2020/t20/t20WomenMatches2Teams/India-England-allMatches.RData")
ind_eng_matches <- matches
m <-teamBatsmenPartnershiOppnAllMatches(ind_eng_matches,'India',report="detailed")
m[1:30,]
##       batsman      nonStriker partnershipRuns totalRuns
## 1       M Raj        A Sharma               2       233
## 2       M Raj      BS Fulmali              25       233
## 3       M Raj       DB Sharma              16       233
## 4       M Raj          H Kaur              18       233
## 5       M Raj       J Goswami               6       233
## 6       M Raj         KV Jain               5       233
## 7       M Raj        L Kumari               5       233
## 8       M Raj     N Niranjana               3       233
## 9       M Raj        N Tanwar              17       233
## 10      M Raj         PG Raut              41       233
## 11      M Raj      R Malhotra               5       233
## 12      M Raj      S Mandhana              17       233
## 13      M Raj          S Naik              10       233
## 14      M Raj        S Pandey              19       233
## 15      M Raj        SK Naidu              37       233
## 16      M Raj V Krishnamurthy               7       233
## 17 S Mandhana          H Deol              20       145
## 18 S Mandhana    JI Rodrigues              47       145
## 19 S Mandhana           M Raj              32       145
## 20 S Mandhana   Shafali Verma              46       145
## 21     H Kaur        A Sharma               1       137
## 22     H Kaur        AA Patil               8       137
## 23     H Kaur       DB Sharma              14       137
## 24     H Kaur         E Bisht               3       137
## 25     H Kaur       J Goswami              11       137
## 26     H Kaur    JI Rodrigues              12       137
## 27     H Kaur           M Raj              19       137
## 28     H Kaur      MR Meshram              33       137
## 29     H Kaur        N Tanwar               2       137
## 30     H Kaur         PG Raut               0       137

13. Team batting partnerships (plot)

Plot the batting partnership of Indian T20 womern against England

The best batsmen are Mithali Raj, Smriti Mandhana and Harmanpreet Kaur in that order

teamBatsmenPartnershipOppnAllMatchesChart(ind_eng_matches,"India","England")

14. Team Wicketkind

Plot the wicket kind taken by the bowlers of Scotland against USA

load("../../../yorkrData2020/t20/t20WomenMatches2Teams/Scotland-United States of America-allMatches.RData")
sco_usa_matches <- matches
teamBowlersWicketsOppnAllMatches(sco_usa_matches,"Scotalnd","USA")

Performance of teams against all other teams in all T20 matches (Class 3)

15. Overall team scorecard

Print the batting scorecard of Zimbabwe against all other teams

load("../../../yorkrData2020/t20/t20WomenAllMatchesAllTeams/allMatchesAllOpposition-Zimbabwe.RData")
zim_matches <- matches
m <-teamBattingScorecardAllOppnAllMatches(zim_matches,theTeam="Zimbabwe")
## Total= 571
m
## # A tibble: 7 x 5
##   batsman      ballsPlayed fours sixes  runs
##   <chr>              <int> <int> <int> <dbl>
## 1 SM Mayers            181    20     3   216
## 2 M Mupachikwa         139     9    NA   125
## 3 CS Mugeri             88     9     2   119
## 4 M Musonda             38     2     1    46
## 5 J Nkomo               25     3    NA    34
## 6 A Ndiraya             14     3    NA    18
## 7 AC Mushangwe          13    NA    NA    13

15. Team batting partnerships

Print the batting partnership of West Indies. The best performances are by 1. Stafanie Taylor 2. Deandra Dottin 3. Hayley Matthews

load("../../../yorkrData2020/t20/t20WomenAllMatchesAllTeams/allMatchesAllOpposition-West Indies.RData")
wi_matches <- matches
m <- teamBatsmenPartnershipAllOppnAllMatches(wi_matches,theTeam='West Indies')
m
## # A tibble: 29 x 2
##    batsman        totalRuns
##    <chr>              <dbl>
##  1 SR Taylor           1199
##  2 DJS Dottin           912
##  3 HK Matthews          458
##  4 SA Campbelle         407
##  5 B Cooper             300
##  6 SACA King            287
##  7 MR Aguilleira        250
##  8 CN Nation            243
##  9 Kycia A Knight       240
## 10 NY McLean            142
## # … with 19 more rows

16. Team bowling wicketkind

The plot below shows the women T20 bowlers who have performed the best against India namely 1. Katherine Brunt (Eng) 2. Elysse Perry (Aus) 3. Anya Shrubsole

load("../../../yorkrData2020/t20/t20WomenAllMatchesAllTeams/allMatchesAllOpposition-India.RData")
ind_matches <- matches
teamBowlingWicketKindAllOppnAllMatches(ind_matches,t1="India",t2="All")

Analyze women T20 batsmen & bowlers (Class 4)

17. T20 batsmen performances

The following 4 players were chosen

  1. Harmanpreet Kaur (Ind)
  2. Suzie Bates (NZ)
  3. Meg Lanning (Aus)
  4. Stafanie Tay;or (WI)
#india_details <- getTeamBattingDetails("India",dir="../../../yorkrData2020/t20/t20WomenMatches", save=TRUE,odir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
#eng_details <- getTeamBattingDetails("England",dir="../../../yorkrData2020/t20/t20WomenMatches", save=TRUE,odir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
#aus_details <- getTeamBattingDetails("Australia",dir="../../../yorkrData2020/t20/t20WomenMatches", save=TRUE,odir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
#wi_details <-  getTeamBattingDetails("West Indies",dir="../../../yorkrData2020/t20/t20WomenMatches", save=TRUE,odir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
#nz_details <-  getTeamBattingDetails("New Zealand",dir="../../../yorkrData2020/t20/t20WomenMatches", save=TRUE,odir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")

harmanpreet <- getBatsmanDetails(team="India",name="H Kaur",dir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
## [1] "../../../yorkrData2020/t20/t20WomenBattingBowlingDetails/India-BattingDetails.RData"
suzie <- getBatsmanDetails(team="New Zealand",name="SW Bates",dir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
## [1] "../../../yorkrData2020/t20/t20WomenBattingBowlingDetails/New Zealand-BattingDetails.RData"
meg <- getBatsmanDetails(team="Australia",name="MM Lanning",dir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
## [1] "../../../yorkrData2020/t20/t20WomenBattingBowlingDetails/Australia-BattingDetails.RData"
stafanie <- getBatsmanDetails(team="West Indies",name="SR Taylor",dir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
## [1] "../../../yorkrData2020/t20/t20WomenBattingBowlingDetails/West Indies-BattingDetails.RData"

Plot the performance of the players against opposition.

batsmanRunsAgainstOpposition(harmanpreet,"Harmanpreet")

batsmanRunsAgainstOpposition(suzie,"Suzie Bates")

batsmanRunsAgainstOpposition(stafanie,"Stafanie Taylor")

batsmanRunsAgainstOpposition(meg,"Meg Lanning")

Plot the cumulative strike rate of the players. Meg Lanning has the best strike rate of the lot. Stafanie and Suzie also touch a strike rate of 100

p1<-batsmanCumulativeStrikeRate(harmanpreet,"Harmanpreet")
p2<-batsmanCumulativeStrikeRate(suzie,"Suzie Bates")
p3<-batsmanCumulativeStrikeRate(stafanie,"Stafanie Taylor")
p4 <-batsmanCumulativeStrikeRate(meg,"Meg Lanning")
grid.arrange(p1,p2,p3,p4, ncol=2)

Analyze women’s T20 bowlers.

18. T20 bowler performances

The following bowlers were chosen for analysis

  1. Poonam Yadav (Ind)
  2. Anisa Mohammed (WI)
  3. Ellyse Perry (Aus)
  4. Anya Shrubsole (England)
#india_details <- getTeamBowlingDetails("India",dir="../../../yorkrData2020/t20/t20WomenMatches", save=TRUE,odir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
#wi_details <- getTeamBowlingDetails("West Indies",dir="../../../yorkrData2020/t20/t20WomenMatches", save=TRUE,odir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
#aus_details <- getTeamBowlingDetails("Australia",dir="../../../yorkrData2020/t20/t20WomenMatches", save=TRUE,odir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
#eng_details <- getTeamBowlingDetails("England",dir="../../../yorkrData2020/t20/t20WomenMatches", save=TRUE,odir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")

poonam <- getBowlerWicketDetails(team="India",name="Poonam Yadav",dir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
anisa <- getBowlerWicketDetails(team="West Indies",name="A Mohammed",dir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
ellyse <- getBowlerWicketDetails(team="Australia",name="EA Perry",dir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")
anya <- getBowlerWicketDetails(team="England",name="A Shrubsole",dir="../../../yorkrData2020/t20/t20WomenBattingBowlingDetails")

Plot the bowler’s moving average

p1<-bowlerMovingAverage(poonam,"Poonam Yadav")
p2<-bowlerMovingAverage(anisa,"Anisa M")
p3 <-bowlerMovingAverage(ellyse,"Ellyse Perry")
p4 <-bowlerMovingAverage(anya,"Anya Shrubsole")
grid.arrange(p1,p2,p3,p4, ncol=2)

Plot the bowlers Cumulative Average Wickets

p1<-bowlerCumulativeAvgWickets(poonam,"Poonam Yadav")
p2<-bowlerCumulativeAvgWickets(anisa,"Anisa M")
p3 <-bowlerCumulativeAvgWickets(ellyse,"Ellyse Perry")
p4 <-bowlerCumulativeAvgWickets(anya,"Anya Shrubsole")
grid.arrange(p1,p2,p3,p4, ncol=2)

3a. Rank women ODI batsmen

Note: Mithali Raj (Ind) tops the ODI table with the most runs and highest average in ODI. The Cricsheet data does not have the earlier years in which she played. Hence you may see a much lower average for Mithali Raj

library(yorkr)
dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/odi/odiWomenMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/odi/odiWomenBattingBowlingDetails"

rankODIBatsmen(dir=dir,odir=odir,minMatches=30)

## # A tibble: 24 x 4
##    batsman          matches meanRuns meanSR
##    <chr>              <int>    <dbl>  <dbl>
##  1 AE Satterthwaite      32     61.5   81.2
##  2 MM Lanning            47     49.5   85.0
##  3 TT Beaumont           35     45.8   68.5
##  4 EA Perry              42     45.7   74.3
##  5 SW Bates              42     44.0   70.9
##  6 NR Sciver             35     43.0   94.7
##  7 M Raj                 35     42.8   64.1
##  8 AC Jayangani          48     38.6   59.9
##  9 NE Bolton             32     36.5   60.5
## 10 T Chetty              34     33.1   70.3
## # … with 14 more rows

3b. Rank women ODI bowlers

Note: Jhulan Goswami tops the ODI bowlers with the most wickets. However the rank below is based on the available data in Cricsheet

library(yorkr)
dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/odi/odiWomenMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/odi/odiWomenBattingBowlingDetails"

rankODIBowlers(dir=dir,odir=odir,minMatches=30)

## # A tibble: 19 x 4
##    bowler        matches totalWickets meanER
##    <chr>           <int>        <dbl>  <dbl>
##  1 JL Jonassen        44           76   3.90
##  2 M Kapp             49           70   3.80
##  3 S Ismail           44           65   3.82
##  4 KH Brunt           42           62   3.57
##  5 EA Perry           43           58   4.44
##  6 A Shrubsole        41           58   4.07
##  7 J Goswami          33           58   3.59
##  8 S Luus             41           54   4.82
##  9 D van Niekerk      40           53   3.84
## 10 ML Schutt          35           48   4.46
## 11 A Khaka            33           47   4.08
## 12 JL Gunn            30           43   4.23
## 13 I Ranaweera        35           42   4.89
## 14 Sana Mir           32           41   4.29
## 15 LA Marsh           30           40   4.16
## 16 NR Sciver          36           37   4.64
## 17 NR Sciver          36           37   4.64
## 18 NR Sciver          36           37   4.64
## 19 NR Sciver          36           37   4.64

4a. Rank women T20 batsman

library(yorkr)
dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/t20/t20WomenMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/t20/t20WomenBattingBowlingDetails"

rankT20Batsmen(dir=dir,odir=odir,minMatches=30)

## # A tibble: 30 x 4
##    batsman       matches meanRuns meanSR
##    <chr>           <int>    <dbl>  <dbl>
##  1 SR Taylor          39     33.1   96.7
##  2 MM Lanning         53     29.3  102. 
##  3 EJ Villani         32     28.2   94.8
##  4 D van Niekerk      41     27.3   88.2
##  5 SJ Taylor          46     26.7  100. 
##  6 SW Bates           35     26.1   99.8
##  7 AC Jayangani       41     25.5   94.7
##  8 Bismah Maroof      52     24.5   83.0
##  9 DJS Dottin         38     24    109. 
## 10 CM Edwards         44     23.7   94.1
## # … with 20 more rows

4b. Rank women T20 bowlers

library(yorkr)
dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/t20/t20WomenMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/t20/t20WomenBattingBowlingDetails"

rankT20Bowlers(dir=dir,odir=odir,minMatches=30)
## # A tibble: 20 x 4
##    bowler           matches totalWickets meanER
##    <chr>              <int>        <dbl>  <dbl>
##  1 A Shrubsole           50           76   5.95
##  2 Nida Dar              50           59   5.99
##  3 KH Brunt              49           57   5.93
##  4 JL Jonassen           50           55   5.31
##  5 EA Perry              51           52   5.67
##  6 S Ismail              50           52   5.40
##  7 ML Schutt             39           50   6.17
##  8 D van Niekerk         39           47   5.45
##  9 D Hazell              35           44   4.95
## 10 NR Sciver             44           43   6.30
## 11 JL Gunn               30           41   6.14
## 12 A Mohammed            43           41   5.80
## 13 M Kapp                31           39   5.08
## 14 Asmavia Iqbal         33           36   6.39
## 15 Sana Mir              46           36   5.85
## 16 HASD Siriwardene      35           33   6.31
## 17 EA Osborne            30           31   5.62
## 18 S Luus                37           29   7.13
## 19 KDU Prabodhani        33           25   4.87
## 20 Bismah Maroof         35           22   6.49

Conclusion

While I have just shown how to use a small subset of functions, you can use the entire set of yorkr functions to analyze individual matches, head-2-head confrontation of two teams, performance of a teams against all other teams and finally performance of individual batsmen and bowlers in women’s ODI and T20 games.

You may also like

  1. Understanding Neural Style Transfer with Tensorflow and Keras
  2. Using Reinforcement Learning to solve Gridworld
  3. Big Data-4: Webserver log analysis with RDDs, Pyspark, SparkR and SparklyR
  4. Cricpy takes a swing at the ODIs
  5. GooglyPlus: yorkr analyzes IPL players, teams, matches with plots and tables
  6. Cricketr adds team analytics to its repertoire!!!
  7. Deep Learning from first principles in Python, R and Octave – Part 8
  8. Natural language processing: What would Shakespeare say?
  9. Simulating an Edge Shape in Android

To see all posts click Index of posts

Revitalizing R package yorkr

There is nothing so useless as doing efficiently that which should not be done at all. Peter Drucker

The most important thing in communication is to hear what isn’t being said. Peter Drucker

“Work expands to fill the time available for its completion.” Corollary: “Expenditure rises to meet income.” Parkinson’s law

Introduction

“Operation successful!!!the Programmer Surgeon in me, thought to himself. What should have been a routine surgery, turned out to be a major operation in the end, which involved several grueling hours. The surgeon looked at the large chunks of programming logic in the operation tray, which had been surgically removed, as they had outlived their utility and had partly become dysfunctional. The surgeon glanced at the new, concise code logic which had replaced the earlier somewhat convoluted logic, with a smile of satisfaction,

To, those who tuned in late, I am referring to my R package yorkr which I had created in many years ago, in early 2016. The package had worked well for quite some time on data from Cricsheet. Cricsheet went into a hiatus in late 2017-2018, and came alive back in 2019. Unfortunately, a key function in the package, started to malfunction. The diagnosis was that the format of the YAML files had changed, in newer files, which resulted in the problem. I had got mails from users mentioning that yorkr was not converting the new YAML files. This was on my to do list for a long time, and a week or two back, I decided to “bite the bullet” and fix the issue. I hoped the fix would be trivial but it was anything but. Finally, I took the hard decision of re-designing the core of the yorkr package, which involved converting YAML files to RData (dataframes). Also, since it has been a while since I did R code, having done more of Python stuff in recent times, I had to jog my memory with my earlier 2 posts Essential R and R vs Python

I spent many hours, tweaking and fixing the new logic so that it worked on the older and new files. Finally, I am happy to say that the new code is much more compact and probably less error prone.

I also had to ensure that the converted files performed exactly on all the other yorkr functions. I ran all the my yorkr functions in my yorkr posts on ODI, Intl. T20 and IPL and made sure the results were identical. (Phew!!)

The changes will be available in CRAN in yorkr_0.0.8

Do take a look at my yorkr posts. All the functions work correctly. Do use help, as I have changed a few functions. I will have my posts reflect the correct usage, but some function or other may slip the cracks.

  1. One Day Internationals ODI-Part1ODI-Part2ODI-Part3ODI-Part4
  2. International T20s – T20-Part1,T20-Part2,T20-Part3,T20-Part4
  3. Indian Premier League IPL-Part1IPL-Part2,IPL-Part3IPL-Part4

While making the changes, I also touched up some functions and made them more user friendly (added additional arguments etc). But by and large, yorkr is still yorkr and is intact.It just sports some spanking, new YAML conversion logic.

Note:

  1. The code is available in Github yorkr
  2. This RMarkdown has been published at RPubs Revitalizing yorkr
  3. I have already converted the YAML files for ODI, Intl T20 and IPL. You can access and download the converted data from Github at yorkrData2020
setwd("/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrgit")
install.packages("yorkr_0.0.8.tar.gz",repos = NULL, type="source")
library(yorkr)

Checkout my interactive Shiny apps GooglyPlus2021 (interactive plots ) and GooglyPlusPlus2021 (analysis in specific intervals) which can be used to analyze IPL players, teams and matches.

Below I rank batsmen and bowlers in ODIs, T20 and IPL based on the data from Cricsheet.

1a. Rank ODI Batsmen

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/odi/odiMenMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/odi/odiBattingBowlingDetails"

rankODIBatsmen(dir=dir,odir=odir,minMatches=50)

## # A tibble: 151 x 4
##    batsman        matches meanRuns meanSR
##    <chr>            <int>    <dbl>  <dbl>
##  1 Babar Azam          52     50.2   87.2
##  2 SD Hope             51     48.7   71.0
##  3 V Kohli            207     48.4   79.4
##  4 HM Amla            159     46.6   82.4
##  5 DA Warner          114     46.1   88.0
##  6 AB de Villiers     190     45.5   94.5
##  7 JE Root            108     44.9   82.5
##  8 SR Tendulkar        96     43.9   77.1
##  9 IJL Trott           63     43.1   68.9
## 10 Q de Kock          106     42.0   82.7
## # … with 141 more rows

1b. Rank ODI Bowlers

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/odi/odiMenMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/odi/odiBattingBowlingDetails"

rankODIBowlers(dir=dir,odir=odir,minMatches=30)
## # A tibble: 265 x 4
##    bowler           matches totalWickets meanER
##    <chr>              <int>        <dbl>  <dbl>
##  1 SL Malinga           191          308   5.25
##  2 MG Johnson           142          238   4.73
##  3 Shakib Al Hasan      157          214   4.72
##  4 Shahid Afridi        166          213   4.69
##  5 JM Anderson          143          207   4.96
##  6 KMDN Kulasekara      161          190   4.94
##  7 SCJ Broad            115          189   5.31
##  8 DW Steyn             114          188   4.96
##  9 Mashrafe Mortaza     139          180   4.97
## 10 Saeed Ajmal          106          180   4.17
## # … with 255 more rows

2a. Rank T20 Batsmen

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/t20/t20MenMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/t20/t20BattingBowlingDetails"

rankT20Batsmen(dir=dir,odir=odir,minMatches=50)
## # A tibble: 43 x 4
##    batsman          matches meanRuns meanSR
##    <chr>              <int>    <dbl>  <dbl>
##  1 V Kohli               61     39.0   132.
##  2 Mohammad Shahzad      52     31.8   123.
##  3 CH Gayle              50     31.1   124.
##  4 BB McCullum           69     30.7   126.
##  5 PR Stirling           66     29.6   116.
##  6 MJ Guptill            70     29.6   125.
##  7 DA Warner             75     29.1   128.
##  8 AD Hales              50     28.1   120.
##  9 TM Dilshan            78     26.7   105.
## 10 RG Sharma             72     26.4   120.
## # … with 33 more rows

2b. Rank T20 Bowlers

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/t20/t20MenMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/t20/t20BattingBowlingDetails"

rankT20Bowlers(dir=dir,odir=odir,,minMatches=30)

## # A tibble: 153 x 4
##    bowler          matches totalWickets meanER
##    <chr>             <int>        <dbl>  <dbl>
##  1 SL Malinga           78          115   7.39
##  2 Shahid Afridi        89           98   6.80
##  3 Saeed Ajmal          62           92   6.30
##  4 Umar Gul             56           87   7.40
##  5 KMDN Kulasekara      56           72   7.25
##  6 TG Southee           55           69   8.68
##  7 DJ Bravo             60           69   8.41
##  8 DW Steyn             47           69   7.00
##  9 Shakib Al Hasan      57           69   6.82
## 10 SCJ Broad            55           68   7.83
## # … with 143 more rows

3a. Rank IPL Batsmen

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/ipl/iplMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/ipl/iplBattingBowlingDetails"


rankIPLBatsmen(dir=dir,odir=odir,,minMatches=50)
## # A tibble: 69 x 4
##    batsman        matches meanRuns meanSR
##    <chr>            <int>    <dbl>  <dbl>
##  1 DA Warner          130     37.9   128.
##  2 CH Gayle           125     36.2   134.
##  3 SE Marsh            67     35.9   120.
##  4 MEK Hussey          59     33.8   105.
##  5 KL Rahul            59     33.5   128.
##  6 V Kohli            175     31.6   119.
##  7 AM Rahane          116     30.7   108.
##  8 AB de Villiers     141     30.3   135.
##  9 F du Plessis        65     29.4   117.
## 10 S Dhawan           140     29.0   114.
## # … with 59 more rows

3a. Rank IPL Bowlers

dir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/ipl/iplMatches"
odir="/Users/tvganesh/backup/software/cricket-package/yorkr-cricsheet/yorkrData2020/ipl/iplBattingBowlingDetails"

rankIPLBowlers(dir=dir,odir=odir,,minMatches=30)
## # A tibble: 143 x 4
##    bowler          matches totalWickets meanER
##    <chr>             <int>        <dbl>  <dbl>
##  1 SL Malinga          120          184   6.99
##  2 SP Narine           108          137   6.71
##  3 Harbhajan Singh     131          134   7.11
##  4 DJ Bravo             85          118   8.18
##  5 B Kumar              86          116   7.43
##  6 YS Chahal            82          102   7.85
##  7 R Ashwin             92           98   6.81
##  8 JJ Bumrah            76           91   7.47
##  9 PP Chawla            85           87   8.02
## 10 RA Jadeja            89           85   7.93
## # … with 133 more rows

##Conclusion

Go ahead and give yorkr a spin once yorkr_0.0.8 is available in CRAN. I hope you have fun. Do get back to me if you have any issues.

I’ll be back. Watch this space!!

You may also like

  1. The mechanics of Convolutional Neural Networks in Tensorflow and Keras
  2. Big Data-5: kNiFi-ing through cricket data with yorkpy
  3. Using Linear Programming (LP) for optimizing bowling change or batting lineup in T20 cricket
  4. Re-introducing cricketr! : An R package to analyze performances of cricketers
  5. Deep Learning from first principles in Python, R and Octave – Part 6
  6. A primer on Qubits, Quantum gates and Quantum Operations
  7. Practical Machine Learning with R and Python – Part 3
  8. Pitching yorkpy … short of good length to IPL – Part 1

To see all posts click Index of posts

Cricketr learns new tricks : Performs fine-grained analysis of players

“He felt that his whole life was some kind of dream and he sometimes wondered whose it was and whether they were enjoying it.”

“The ships hung in the sky in much the same way that bricks don’t.”

“We demand rigidly defined areas of doubt and uncertainty!”

“For a moment, nothing happened. Then, after a second or so, nothing continued to happen.”

“The Answer to the Great Question… Of Life, the Universe and Everything… Is… Forty-two,’ said Deep Thought, with infinite majesty and calm.”

                 The Hitchhiker's Guide to the Galaxy - Douglas Adams

Introduction

In this post, I introduce 2 new functions in my R package ‘cricketr’ (cricketr v0.22) see Re-introducing cricketr! : An R package to analyze performances of cricketers which enable granular analysis of batsmen and bowlers. They are

  1. Step 1: getPlayerDataHA – This function is a wrapper around getPlayerData(), getPlayerDataOD() and getPlayerDataTT(), and adds an extra column ‘homeOrAway’ which says whether the match was played at home/away/neutral venues. A CSV file is created with this new column.
  2. Setp 2: getPlayerDataOppnHA – This function allows you to slice & dice the data for batsmen and bowlers against specific oppositions, at home/away/neutral venues and between certain periods. This reduced subset of data can be used to perform analyses. A CSV file is created as an output based on the parameters of opposition, home or away and the interval of time

Note All the existing cricketr functions can be used on this smaller fine-grained data set for a closer analysis of players

Note 1: You have to call the above functions only once. You can reuse the CSV files in other functions

Important note: Don’t go too fine-grained by choosing just one opposition, in one of home/away/neutral and for too short a period. Too small a dataset may defeat the purpose of the analysis!

This post has been published in Rpubs and can be accessed at Cricketr learns new tricks

You can download a PDF version of this post at Cricketr learns new tricks

If you are passionate about cricket, and love analyzing cricket performances, then check out my racy book on cricket ‘Cricket analytics with cricketr and cricpy – Analytics harmony with R & Python’! This book discusses and shows how to use my R package ‘cricketr’ and my Python package ‘cricpy’ to analyze batsmen and bowlers in all formats of the game (Test, ODI and T20). The paperback is available on Amazon at $21.99 and  the kindle version at $9.99/Rs 449/-. A must read for any cricket lover! Check it out!!

Untitled

1. Analyzing Tendulkar at 3 different stages of his career

The following functions analyze Sachin Tendulkar during 3 different periods of his illustrious career. a) 1st Jan 2001-1st Jan 2002 b) 1st Jan 2005-1st Jan 2006 c) 1st Jan 2012-1st Jan 2013

# Get the homeOrAway dataset for Tendulkar in matches
#Note: I have commented the lines to getPlayerDataHA() as I already have 
# CSV file
#df=getPlayerDataHA(35320,tfile="tendulkarTestHA.csv",matchType="Test")

# Get Tendulkar's data for 2001-02
df1=getPlayerDataOppnHA(infile="tendulkarHA.csv",outfile="tendulkarTest2001.csv",
                         startDate="2001-01-01",endDate="2002-01-01")

# Get Tendulkar's data for 2005-06
df2=getPlayerDataOppnHA(infile="tendulkarHA.csv",outfile="tendulkarTest2005.csv",

                                               startDate="2005-01-01",endDate="2006-01-01")

# Get Tendulkar's data for 20012-13
#df3=getPlayerDataOppnHA(infile="tendulkarHA.csv",outfile="tendulkarTest2012.csv",
#                        startDate="2012-01-01",endDate="2013-01-01")

`

1a Mean strike rate of Tendulkar in 2001,2005,2012

Note: Any of the cricketr R functions can be used on the fine-grained subset of data as below. The mean strike rate of Tendulkar is of the order of 60+ in 2001 which decreases to 50 and later to around 45

# Compute and plot mean strike rate of Tendulkar in the 3 periods
batsmanMeanStrikeRate ("./tendulkarTest2001.csv","Tendulkar-2001")

batsmanMeanStrikeRate ("./tendulkarTest2005.csv","Tendulkar-2005")

batsmanMeanStrikeRate ("./tendulkarTest2012.csv","Tendulkar-2012")

1b. Plot the performance of Tendulkar at venues during 2001,2005,2012

On an average Tendulkar score 60+ in 2001 and is really blazing. This performance decreases in 2005 and later in 2012

par(mfrow=c(1,3))
par(mar=c(4,4,2,2))
batsmanAvgRunsGround("tendulkarTest2001.csv","Tendulkar-2001")
batsmanAvgRunsGround("tendulkarTest2005.csv","Tendulkar-2005")
batsmanAvgRunsGround("tendulkarTest2012.csv","Tendulkar-2012")

dev.off()

 

 

1c. Plot the performance of Tendulkar against different oppositions during 2001,2005,2012

Sachin uniformly scores 50+ against formidable oppositions in 2001. In 2005 this decreases to 40 in 2005 and in 2012 it is around 25

batsmanAvgRunsOpposition("tendulkarTest2001.csv","Tendulkar-2001")
batsmanAvgRunsOpposition("tendulkarTest2005.csv","Tendulkar-2005")

batsmanAvgRunsOpposition("tendulkarTest2012.csv","Tendulkar-2012")

1d. Plot the relative cumulative average and relative strike rate of Tendulkar in 2001,2005,2012

The plot below compares Tendulkar’s cumulative strike rate and cumulative average during 3 different stages of his career

  1. The cumulative average runs of Tendulkar is in the high 60+ in 2001, which drops to ~50 in 2005 and later plummets to the low 25s in 2012
  2. The strike rate in 2001 for Tendulkar is amazing 60+
frames=list("tendulkarTest2001.csv","tendulkarTest2005.csv","tendulkarTest2012.csv")
names=list("Tendulkar-2001","Tendulkar-2005","Tendulkar-2012")
relativeBatsmanCumulativeAvgRuns(frames,names)

relativeBatsmanCumulativeStrikeRate(frames,names)

2. Analyzing Virat Kohli’s performance against England in England in 2014 and 2018

The analysis below looks at Kohli’s performance against England in ‘away’ venues (England) in 2014 and 2018

# Get the homeOrAway data for Kohli in Test matches
#df=getPlayerDataHA(253802,tfile="kohliTestHA.csv",type="batting",matchType="Test")

# Get the subset if data of Kohli's performance against England in England in 2014
df=getPlayerDataOppnHA(infile="kohliTestHA.csv",outfile="kohliTestEng2014.csv",
   opposition=c("England"),homeOrAway=c("away"),startDate="2014-01-01",endDate="2015-01-01")

# Get the subset if data of Kohli's performance against England in England in 2018
df1=getPlayerDataOppnHA(infile="kohliHA.csv",outfile="kohliTestEng2018.csv",
   opposition=c("England"),homeOrAway=c("away"),startDate="2018-01-01",endDate="2019-01-01")

2a. Kohli’s performance at England grounds in 2014 & 2018

Kohli had a miserable outing to England in 2014 with a string of low scores. In 2018 Kohli pulls himself out of the morass

batsmanAvgRunsGround("kohliTestEng2014.csv","Kohli-Eng-2014")

batsmanAvgRunsGround("kohliTestEng2018.csv","Kohli-Eng-2018")

2a. Kohli’s cumulative average runs in 2014 & 2018

Kohli’s cumulative average runs in 2014 is in the low 15s, while in 2018 it is 70+. Kohli stamps his class back again and undoes the bad memories of 2014

batsmanCumulativeAverageRuns("kohliTestEng2014.csv", "Kohli-Eng-2014")

batsmanCumulativeAverageRuns("kohliTestEng2018.csv", "Kohli-Eng-2018")

3a. Compare the performances of Ganguly, Dravid and VVS Laxman against opposition in ‘away’ matches in Tests

The analyses below compares the performances of Sourav Ganguly, Rahul Dravid and VVS Laxman against Australia, South Africa, and England in ‘away’ venues between 01 Jan 2002 to 01 Jan 2008

#Get the HA data for Ganguly, Dravid and Laxman
#df=getPlayerDataHA(28779,tfile="gangulyTestHA.csv",type="batting",matchType="Test")
#df=getPlayerDataHA(28114,tfile="dravidTestHA.csv",type="batting",matchType="Test")
#df=getPlayerDataHA(30750,tfile="laxmanTestHA.csv",type="batting",matchType="Test")


# Slice the data 
df=getPlayerDataOppnHA(infile="gangulyTestHA.csv",outfile="gangulyTestAES2002-08.csv"
                       ,opposition=c("Australia", "England", "South Africa"),
                       homeOrAway=c("away"),startDate="2002-01-01",endDate="2008-01-01")


df=getPlayerDataOppnHA(infile="dravidTestHA.csv",outfile="dravidTestAES2002-08.csv"
                       ,opposition=c("Australia", "England", "South Africa"),
                       homeOrAway=c("away"),startDate="2002-01-01",endDate="2008-01-01")


df=getPlayerDataOppnHA(infile="laxmanTestHA.csv",outfile="laxmanTestAES2002-08.csv"
                       ,opposition=c("Australia", "England", "South Africa"),
                       homeOrAway=c("away"),startDate="2002-01-01",endDate="2008-01-01")

3b Plot the relative cumulative average runs and relative cumative strike rate

Plot the relative cumulative average runs and relative cumative strike rate of Ganguly, Dravid and Laxman

-Dravid towers over Laxman and Ganguly with respect to cumulative average runs. – Ganguly has a superior strike rate followed by Laxman and then Dravid

frames=list("gangulyTestAES2002-08.csv","dravidTestAES2002-08.csv","laxmanTestAES2002-08.csv")
names=list("GangulyAusEngSA2002-08","DravidAusEngSA2002-08","LaxmanAusEngSA2002-08")
relativeBatsmanCumulativeAvgRuns(frames,names)

relativeBatsmanCumulativeStrikeRate(frames,names)

4. Compare the ODI performances of Rohit Sharma, Joe Root and Kane Williamson against opposition

Compare the performances of Rohit Sharma, Joe Root and Kane williamson in away & neutral venues against Australia, West Indies and Soouth Africa

  • Joe Root piles us the runs in about 15 matches. Rohit has played far more ODIs than the other two and averages a steady 35+
# Get the ODI HA data for Rohit, Root and Williamson
#df=getPlayerDataHA(34102,tfile="rohitODIHA.csv",type="batting",matchType="ODI")
#df=getPlayerDataHA(303669,tfile="joerootODIHA.csv",type="batting",matchType="ODI")
#df=getPlayerDataHA(277906,tfile="williamsonODIHA.csv",type="batting",matchType="ODI")

# Subset the data for specific opposition in away and neutral venues
df=getPlayerDataOppnHA(infile="rohitODIHA.csv",outfile="rohitODIAusWISA.csv"
                       ,opposition=c("Australia", "West Indies", "South Africa"),
                      homeOrAway=c("away","neutral"))

df=getPlayerDataOppnHA(infile="joerootODIHA.csv",outfile="joerootODIAusWISA.csv"
                       ,opposition=c("Australia", "West Indies", "South Africa"),
                       homeOrAway=c("away","neutral"))

df=getPlayerDataOppnHA(infile="williamsonODIHA.csv",outfile="williamsonODIAusWiSA.csv"
                       ,opposition=c("Australia", "West Indies", "South Africa"),
                       homeOrAway=c("away","neutral"))

4a. Compare cumulative strike rates and cumulative average runs of Rohit, Root and Williamson

The relative cumulative strike rate of all 3 are comparable

frames=list("rohitODIAusWISA.csv","joerootODIAusWISA.csv","williamsonODIAusWiSA.csv")
names=list("Rohit-ODI-AusWISA","Joe Root-ODI-AusWISA","Williamson-ODI-AusWISA")
relativeBatsmanCumulativeAvgRuns(frames,names)

relativeBatsmanCumulativeStrikeRate(frames,names)

5. Plot the performance of Dhoni in T20s against specific opposition at all venues

Plot the performances of Dhoni against Australia, West Indies, South Africa and England

# Get the HA T20 data for Dhoni
#df=getPlayerDataHA(28081,tfile="dhoniT20HA.csv",type="batting",matchType="T20")

#Subset the data
df=getPlayerDataOppnHA(infile="dhoniT20HA.csv",outfile="dhoniT20AusWISAEng.csv"
                       ,opposition=c("Australia", "West Indies", "South Africa","England"),
                       homeOrAway=c("all"))

5a. Plot Dhoni’s performances in T20

Note You can use any of cricketr’s functions against the fine grained data

batsmanAvgRunsOpposition("dhoniT20AusWISAEng.csv","Dhoni")

batsmanAvgRunsGround("dhoniT20AusWISAEng.csv","Dhoni")

batsmanCumulativeStrikeRate("dhoniT20AusWISAEng.csv","Dhoni")

batsmanCumulativeAverageRuns("dhoniT20AusWISAEng.csv","Dhoni")

6. Compute and performances of Anil Kumble, Muralitharan and Warne in ‘away’ test matches

Compute the performances of Kumble, Warne and Maralitharan against New Zealand, West Indies, South Africa and England in pitches that are not ‘home’ pithes

# Get the bowling data for Kumble, Warne and Muralitharan in Test matches
#df=getPlayerDataHA(30176,tfile="kumbleTestHA.csv",type="bowling",matchType="Test")
#df=getPlayerDataHA(8166,tfile="warneTestHA.csv",type="bowling",matchType="Test")
#df=getPlayerDataHA(49636,tfile="muraliTestHA.csv",type="bowling",matchType="Test")


# Subset the data
df=getPlayerDataOppnHA(infile="kumbleTestHA.csv",outfile="kumbleTest-NZWISAEng.csv"
                       ,opposition=c("New Zealand", "West Indies", "South Africa","England"),
                       homeOrAway=c("away"))

df=getPlayerDataOppnHA(infile="warneTestHA.csv",outfile="warneTest-NZWISAEng.csv"
                       ,opposition=c("New Zealand", "West Indies", "South Africa","England"),
                       homeOrAway=c("away"))

df=getPlayerDataOppnHA(infile="muraliTestHA.csv",outfile="muraliTest-NZWISAEng.csv"
                       ,opposition=c("New Zealand", "West Indies", "South Africa","England"),
                       homeOrAway=c("away"))

6a. Plot the average wickets of Kumble, Warne and Murali

bowlerAvgWktsOpposition("kumbleTest-NZWISAEng.csv","Kumble-NZWISAEng-AN")

bowlerAvgWktsOpposition("warneTest-NZWISAEng.csv","Warne-NZWISAEng-AN")

bowlerAvgWktsOpposition("muraliTest-NZWISAEng.csv","Murali-NZWISAEng-AN")

6b. Plot the average wickets in different grounds of Kumble, Warne and Murali

bowlerAvgWktsGround("kumbleTest-NZWISAEng.csv","Kumblew")

bowlerAvgWktsGround("warneTest-NZWISAEng.csv","Warne")

bowlerAvgWktsGround("muraliTest-NZWISAEng.csv","murali")

6c. Plot the cumulative average wickets and cumulative economy rate of Kumble, Warne and Murali

  • Murali has the best economy rate followed by Kumble and then Warne
  • Again Murali has the best cumulative average wickets followed by Warne and then Kumble
frames=list("kumbleTest-NZWISAEng.csv","warneTest-NZWISAEng.csv","muraliTest-NZWISAEng.csv")
names=list("Kumble","Warne","Murali")
relativeBowlerCumulativeAvgEconRate(frames,names)

relativeBowlerCumulativeAvgWickets(frames,names)

7. Compute and plot the performances of Bumrah in 2016, 2017 and 2018 in ODIs

# Get the HA data for Bumrah in ODI in bowling
df=getPlayerDataHA(625383,tfile="bumrahODIHA.csv",type="bowling",matchType="ODI")
## [1] "Working..."
# Slice the data for periods 2016, 2017 and 2018
df=getPlayerDataOppnHA(infile="bumrahODIHA.csv",outfile="bumrahODI2016.csv",
                       startDate="2016-01-01",endDate="2017-01-01")

df=getPlayerDataOppnHA(infile="bumrahODIHA.csv",outfile="bumrahODI2017.csv",
                       startDate="2017-01-01",endDate="2018-01-01")

df=getPlayerDataOppnHA(infile="bumrahODIHA.csv",outfile="bumrahODI2018.csv",
                       startDate="2018-01-01",endDate="2019-01-01")

7a. Compute the performances of Bumrah in 2016, 2017 and 2018

  • Very clearly Bumrah is getting better at his art. His economy rate in 2018 is the best!!!
  • Bumrah has had a very prolific year in 2017. However all the years he seems to be quite effective
frames=list("bumrahODI2016.csv","bumrahODI2017.csv","bumrahODI2018.csv")
names=list("Bumrah-2016","Bumrah-2017","Bumrah-2018")
relativeBowlerCumulativeAvgEconRate(frames,names)

relativeBowlerCumulativeAvgWickets(frames,names)

8. Compute and plot the performances of Shakib, Bumrah and Jadeja in T20 matches for bowling

# Get the HA bowling data for Shakib, Bumrah and Jadeja
df=getPlayerDataHA(56143,tfile="shakibT20HA.csv",type="bowling",matchType="T20")
## [1] "Working..."
df=getPlayerDataHA(625383,tfile="bumrahT20HA.csv",type="bowling",matchType="T20")
## [1] "Working..."
df=getPlayerDataHA(234675,tfile="jadejaT20HA.csv",type="bowling",matchType="T20")
## [1] "Working..."
# Slice the data for performances against Sri Lanka, Australia, South Africa and England
df=getPlayerDataOppnHA(infile="shakibT20HA.csv",outfile="shakibT20-SLAusSAEng.csv"
                       ,opposition=c("Sri Lanka","Australia", "South Africa","England"),
                       homeOrAway=c("all"))
df=getPlayerDataOppnHA(infile="bumrahT20HA.csv",outfile="bumrahT20-SLAusSAEng.csv"
                       ,opposition=c("Sri Lanka","Australia", "South Africa","England"),
                       homeOrAway=c("all"))

df=getPlayerDataOppnHA(infile="jadejaT20HA.csv",outfile="jadejaT20-SLAusSAEng.csv"
                       ,opposition=c("Sri Lanka","Australia", "South Africa","England"),
                       homeOrAway=c("all"))

8a. Compare the relative performances of Shakib, Bumrah and Jadeja

  • Jadeja and Bumrah have comparable economy rates. Shakib is more expensive
  • Shakib pips Bumrah in number of cumulative wickets, though Bumrah is close behind
frames=list("shakibT20-SLAusSAEng.csv","bumrahT20-SLAusSAEng.csv","jadejaT20-SLAusSAEng.csv")
names=list("Shakib-SLAusSAEng","Bumrah-SLAusSAEng","Jadeja-SLAusSAEng")
relativeBowlerCumulativeAvgEconRate(frames,names)

relativeBowlerCumulativeAvgWickets(frames,names)

Conclusion

By getting the homeOrAway data for players using the profileNo, you can slice and dice the data based on your choice of opposition, whether you want matches that were played at home/away/neutral venues. Finally by specifying the period for which the data has to be subsetted you can create fine grained analysis.

Hope you have a great time with cricketr!!!

Also see

1. My book ‘Deep Learning from first principles:Second Edition’ now on Amazon
2. Cricpy takes a swing at the ODIs
3. My book ‘Practical Machine Learning in R and Python: Third edition’ on Amazon
4. Googly: An interactive app for analyzing IPL players, matches and teams using R package yorkr
5. Big Data-2: Move into the big league:Graduate from R to SparkR
6. Rock N’ Roll with Bluemix, Cloudant & NodeExpress
7. A method to crowd source pothole marking on (Indian) roads
8. De-blurring revisited with Wiener filter using OpenCV

To see all posts click Index of posts

Cricketr adds team analytics to its repertoire!!!

And she’s got brains enough for two, which is the exact quantity the girl who marries you will need.

“I’m not absolutely certain of the facts, but I rather fancy it’s Shakespeare who says that it’s always just when a fellow is feeling particularly braced with things in general that Fate sneaks up behind him with the bit of lead piping.”

“A melancholy-looking man, he had the appearance of one who has searched for the leak in life’s gas-pipe with a lighted candle.”

“It isn’t often that Aunt Dahlia lets her angry passions rise, but when she does, strong men climb trees and pull them up after them.”

“Some minds are like soup in a poor restaurant – better left unstirred.”

                                      P.G. Wodehouse

Introduction

My R package cricketr had its genesis about 4 years ago, sometime around June 2015. There were some minor updates afterwards and the package performed analytics on cricketers (Test, ODI and T20) based on data from ESPN Cricinfo see Re-introducing cricketr! : An R package to analyze performances of cricketers. Now, in the latest release of cricketr, I have included 8 functions which can perform Team analytics. Team analysis can be done for Test, ODI and T20 teams.

This package uses the statistics info available in ESPN Cricinfo Statsguru. The current version of this package can handle all formats of the game including Test, ODI and Twenty20 cricket for players (batsmen & bowlers) and also teams (Test, ODI and T20)

You should be able to install the package directly from CRAN. Please be mindful of ESPN Cricinfo Terms of Use

A total of 8 new functions which deal with team analytics has been included in the latest release.

There are 5 functions which are used internally 1) getTeamData b) getTeamNumber c) getMatchType d) getTeamDataHomeAway e) cleanTeamData

and the external functions which are
a) teamWinLossStatusVsOpposition
b) teamWinLossStatusAtGrounds
c) plotTimelineofWinsLosses

All the above functions are common to Test, ODI and T20 teams

The data for a particular Team can be obtained with the getTeamDataHomeAway() function from the package. This will return a dataframe of the team’s win/loss status at home and away venues over a period of time. This can be saved as a CSV file. Once this is done, you can use this CSV file for all subsequent analysis

As before you can get the help for any of the cricketr functions as below

#help(teamWinLossStatusVsOpposition)
Compute the wins/losses/draw/tied etc for a Team in Test, ODI or T20 against opposition
Description
This function computes the won,lost,draw,tied or no result for a team against other teams in home/away or neutral venues and either returns a dataframe or plots it against opposition
Usage
teamWinLossStatusVsOpposition(file,teamName,opposition=c("all"),homeOrAway=c("all"),
      matchType="Test",plot=FALSE)
Arguments
file	
The CSV file for which the plot is required
teamName	
The name of the team for which plot is required
opposition	
Opposition is a vector namely c("all") or c("Australia", "India", "England")
homeOrAway	
This parameter is a vector which is either c("all") or a vector of venues c("home","away","neutral")
matchType	
Match type - Test, ODI or T20
plot	
If plot=FALSE then a data frame is returned, If plot=TRUE then a plot is generated
Value
None
Note
Maintainer: Tinniam V Ganesh tvganesh.85@gmail.com
Author(s)
Tinniam V Ganesh
References

http://www.espncricinfo.com/ci/content/stats/index.html
https://gigadom.in/
See Also
teamWinLossStatusVsOpposition teamWinLossStatusAtGrounds plotTimelineofWinsLosses
Examples
## Not run: 
#Get the team data for India for Tests
df <- getTeamDataHomeAway(teamName="India",file="indiaOD.csv",matchType="ODI")
teamWinLossStatusAtGrounds("india.csv",teamName="India",opposition=c("Australia","England","India"),
                          homeOrAway=c("home","away"),plot=TRUE)
## End(Not run)

This post has been published at RPubs and is available at TeamAnalyticsWithCricketr

You can download PDF version of this post at TeamAnalyticsWithCricketr

1. Get team data

1a. Test

The teams in Test cricket are included below

  1. Afghanistan 2.Bangladesh 3. England 4. World 5. India 6. Ireland 7. New Zealand 8. Pakistan 9. South Africa 10.Sri Lanka 11. West Indies 12.Zimbabwe

You can use this for the teamName paramater. This will return a dataframe and also save the file as a CSV , if save=TRUE

Note: – Since I have already got the data as CSV files I am not executing the lines below

# Get the data for the teams. Save as CSV
#indiaTest <-getTeamDataHomeAway(dir=".",teamView="bat",matchType="Test",file="indiaTest.csv",save=TRUE,teamName="India")
#australiaTest <- getTeamDataHomeAway(matchType="Test",file="australiaTest.csv",save=TRUE,teamName="Australia")
#pakistanTest <- getTeamDataHomeAway(matchType="Test",file="pakistanTest.csv",save=TRUE,teamName="Pakistan")
#newzealandTest <- getTeamDataHomeAway(matchType="Test",file="newzealandTest.csv",save=TRUE,teamName="New Zealand")

1b. ODI

The ODI teams in the world are below. The data for these teams can be got by names as shown below

  1. Afghanistan 2. Africa XI 3. Asia XI 4.Australia 5.Bangladesh
  2. Bermuda 7. England 8. ICC World X1 9. India 11.Ireland 12. New Zealand
  3. Pakistan 14. South Africa 15. Sri Lanka 17. West Indies 18. Zimbabwe
  4. Canada 21. East Africa 22. Hong Kong 23.Ireland 24. Kenya 25. Namibia
  5. Nepal 27.Netherlands 28. Oman 29.Papua New Guinea 30. Scotland
  6. United Arab Emirates 32. United States of America
#indiaODI <- getTeamDataHomeAway(matchType="ODI",file="indiaODI.csv",save=TRUE,teamName="India")
#englandODI <- getTeamDataHomeAway(matchType="ODI",file="englandODI.csv",save=TRUE,teamName="England")
#westindiesODI <- getTeamDataHomeAway(matchType="ODI",file="westindiesODI.csv",save=TRUE,teamName="West Indies")
#irelandODI <- getTeamDataHomeAway(matchType="ODI",file="irelandODI.csv",save=TRUE,teamName="Ireland")

1c T20

The T20 teams in the world are
1.Afghanistan 2. Australia 3. Bahrain 4. Bangladesh 5. Belgium 6. Belize
2.Bermuda 8.Botswana 9. Canada 11. Costa Rica 12. Germany 13. Ghana
14.Guernsey 15. Hong Kong 16. ICC World X1 17.India 18. Ireland 19.Italy
20.Jersey 21. Kenya 22.Kuwait 23.Maldives 24.Malta 25.Mexico 26.Namibia
27.Nepal 28.Netherlands 29. New Zealand 30.Nigeria 31.Oman 32. Pakistan
33.Panama 34.Papua New Guinea 35. Philippines 36.Qatar 37.Saudi Arabia
38.Scotland 39.South Africa 40.Spain 41.Sri Lanka 42.Uganda
43.United Arab Emirates United States of America 44.Vanuatu 45.West Indies

#southafricaT20 <- getTeamDataHomeAway(matchType="T20",file="southafricaT20.csv",save=TRUE,teamName="South Africa")
#srilankaT20 <- getTeamDataHomeAway(matchType="T20",file="srilankaT20.csv",save=TRUE,teamName="Sri Lanka")
#canadaT20 <- getTeamDataHomeAway(matchType="T20",file="canadaT20.csv",save=TRUE,teamName="Canada")
#afghanistanT20 <- getTeamDataHomeAway(matchType="T20",file="afghanistanT20.csv",save=TRUE,teamName="Afghanistan")

2 Analysis of Test matches

The functions below perform analysis of Test teams

2a. Wins vs Loss against opposition

This function performs analysis of Test teams against other teams at home/away or neutral venue. Note:- The opposition can be a vector of opposition teams. Similarly homeOrAway can also be a vector of home/away/neutral venues.

# Get the performance of Indian test team against all teams at all venues as a dataframe
df <- teamWinLossStatusVsOpposition("india.csv",teamName="India",opposition=c("all"),homeOrAway=c("all"),matchType="Test",plot=FALSE)
head(df)
## # A tibble: 6 x 4
## # Groups:   Opposition, Result [4]
##   Opposition  Result ha    count
##   <chr>       <chr>  <chr> <int>
## 1 Afghanistan won    home      1
## 2 Australia   draw   away     20
## 3 Australia   draw   home     23
## 4 Australia   lost   away     58
## 5 Australia   lost   home     26
## 6 Australia   tied   home      2
# Plot the performance of Indian Test team  against all teams at all venues
teamWinLossStatusVsOpposition("indiaTest.csv",teamName="India",opposition=c("all"),homeOrAway=c("all"),matchType="Test",plot=TRUE)

# Get the performance of Australia against India, England and New Zealand at all venues in Tests
df <-teamWinLossStatusVsOpposition("australiaTest.csv",teamName="Australia",opposition=c("India","England","New Zealand"),homeOrAway=c("all"),matchType="Test",plot=FALSE)

#Plot the performance of Australia against England, India and New Zealand only at home (Australia) 
teamWinLossStatusVsOpposition("australiaTest.csv",teamName="Australia",opposition=c("India","England","New Zealand"),homeOrAway=c("home"),matchType="Test",plot=TRUE)

If you are passionate about cricket, and love analyzing cricket performances, then check out my racy book on cricket ‘Cricket analytics with cricketr and cricpy – Analytics harmony with R & Python’! This book discusses and shows how to use my R package ‘cricketr’ and my Python package ‘cricpy’ to analyze batsmen and bowlers in all formats of the game (Test, ODI and T20). The paperback is available on Amazon at $21.99 and  the kindle version at $9.99/Rs 449/-. A must read for any cricket lover! Check it out!!

Untitled

 

2b Wins vs losses of Test teams against opposition at different venues

# Get the  performance of Pakistan against India, West Indies, South Africa at all venues in Tests and show performances at the venues
df <- teamWinLossStatusAtGrounds("pakistanTest.csv",teamName="Pakistan",opposition=c("India","West Indies","South Africa"),homeOrAway=c("all"),matchType="Test",plot=FALSE)
head(df)
## # A tibble: 6 x 4
## # Groups:   Ground, Result [6]
##   Ground     Result ha      count
##   <chr>      <chr>  <chr>   <int>
## 1 Abu Dhabi  draw   neutral     2
## 2 Abu Dhabi  won    neutral     4
## 3 Ahmedabad  draw   away        2
## 4 Bahawalpur draw   home        1
## 5 Basseterre won    away        2
## 6 Bengaluru  draw   away        5
# Plot the performance of New Zealand Test team against England, Sri Lanka and Bangladesh at all grounds playes 
teamWinLossStatusAtGrounds("newzealandTest.csv",teamName="New Zealand",opposition=c("England","Sri Lanka","Bangladesh"),homeOrAway=c("all"),matchType="Test",plot=TRUE)

2c. Plot the time line of wins vs losses of Test teams against opposition at different venues during an interval

# Plot the time line of wins/losses of India against Australia, West Indies, South Africa in away/neutral venues
#from 2000-01-01 to 2017-01-01
plotTimelineofWinsLosses("indiaTest.csv",team="India",opposition=c("Australia","West Indies","South Africa"),
                         homeOrAway=c("away","neutral"), startDate="2000-01-01",endDate="2017-01-01")

#Plot the time line of wins/losses of Indian Test team from 1970 onwards
plotTimelineofWinsLosses("indiaTest.csv",team="India",startDate="1970-01-01",endDate="2017-01-01")

3 ODI

The functions below perform analysis of ODI teams listed above

3a. Wins vs Loss against opposition ODI teams

This function performs analysis of ODI teams against other teams at home/away or neutral venue. Note:- The opposition can be a vector of opposition teams. Similarly homeOrAway can also be a vector of home/away/neutral venues.

# Get the performance of West Indies in ODIs against all other ODI teams at all venues and retirn as a dataframe
df <- teamWinLossStatusVsOpposition("westindiesODI.csv",teamName="West Indies",opposition=c("all"),homeOrAway=c("all"),matchType="ODI",plot=FALSE)
head(df)
## # A tibble: 6 x 4
## # Groups:   Opposition, Result [3]
##   Opposition  Result ha      count
##   <chr>       <chr>  <chr>   <int>
## 1 Afghanistan lost   home        1
## 2 Afghanistan lost   neutral     2
## 3 Afghanistan won    home        1
## 4 Australia   lost   away       41
## 5 Australia   lost   home       25
## 6 Australia   lost   neutral     8
# Plot the performance of West Indies in ODIs against Sri Lanka, India at all venues
teamWinLossStatusVsOpposition("westindiesODI.csv",teamName="West Indies",opposition=c("Sri Lanka", "India"),homeOrAway=c("all"),matchType="ODI",plot=TRUE)

 

#Plot the performance of Ireland in ODIs against Zimbabwe, Kenya, bermuda, UAE, Oman and Scotland at all venues
teamWinLossStatusVsOpposition("irelandODI.csv",teamName="Ireland",opposition=c("Zimbabwe","Kenya","Bermuda","U.A.E.","Oman","Scotland"),homeOrAway=c("all"),matchType="ODI",plot=TRUE)

3b Wins vs losses of ODI teams against opposition at different venues

# Plot the performance of England ODI team against Bangladesh, West Indies and Australia at all venues
teamWinLossStatusAtGrounds("englandODI.csv",teamName="England",opposition=c("Bangladesh","West Indies","Australia"),homeOrAway=c("all"),matchType="ODI",plot=TRUE)

#Plot the performance of India against South Africa, West Indies and Australia at 'home' venues
teamWinLossStatusAtGrounds("indiaODI.csv",teamName="India",opposition=c("South Africa","West Indies","Australia"),homeOrAway=c("home"),matchType="ODI",plot=TRUE)

3c. Plot the time line of wins vs losses of ODI teams against opposition at different venues during an interval

#Plot the time line of wins/losses of Bangladesh ODI team between 2015 and 2019 against all other teams and at
# all venues
plotTimelineofWinsLosses("bangladeshOD.csv",team="Bangladesh",startDate="2015-01-01",endDate="2019-01-01",matchType="ODI")

#Plot the time line of wins/losses of India ODI against Sri Lanka, Bangladesh from 2016 to 2019
plotTimelineofWinsLosses("indiaODI.csv",team="India",opposition=c("Sri Lanka","Bangladesh"),startDate="2016-01-01",endDate="2019-01-01",matchType="ODI")

4 Twenty 20

The functions below perform analysis of Twenty 20 teams listed above

4a. Wins vs Loss against opposition ODI teams

This function performs analysis of T20 teams against other T20 teams at home/away or neutral venue. Note:- The opposition can be a vector of opposition teams. Similarly homeOrAway can also be a vector of home/away/neutral venues.

# Get the performance of South Africa T20 team against England, India and Sri Lanka at home grounds at England
df <- teamWinLossStatusVsOpposition("southafricaT20.csv",teamName="South Africa",opposition=c("England","India","Sri Lanka"),homeOrAway=c("home"),matchType="T20",plot=FALSE)

#Plot the performance of South Africa T20 against England, India and Sri Lanka at all venues
teamWinLossStatusVsOpposition("southafricaT20.csv",teamName="South Africa",opposition=c("England","India","Sri Lanka"),homeOrAway=c("all"),matchType="T20",plot=TRUE)

#Plot the performance of Afghanistan T20 teams against all oppositions
teamWinLossStatusVsOpposition("afghanistanT20.csv",teamName="Afghanistan",opposition=c("all"),homeOrAway=c("all"),matchType="T20",plot=TRUE)

 

 

4b Wins vs losses of T20 teams against opposition at different venues

# Compute the performance of Canada against all opposition at all venues and show by grounds. Return as dataframe
df <-teamWinLossStatusAtGrounds("canadaT20.csv",teamName="Canada",opposition=c("all"),homeOrAway=c("all"),matchType="T20",plot=FALSE)
head(df)
## # A tibble: 6 x 4
## # Groups:   Ground, Result [6]
##   Ground        Result ha      count
##   <chr>         <chr>  <chr>   <int>
## 1 Abu Dhabi     lost   neutral     1
## 2 Belfast       lost   neutral     1
## 3 Belfast       won    neutral     2
## 4 Colombo (SSC) lost   neutral     1
## 5 Colombo (SSC) won    neutral     1
## 6 Dubai (DSC)   lost   neutral     5
# Plot the performance of Sri Lanka T20 team against India and Bangladesh in different venues at home/away and neutral
teamWinLossStatusAtGrounds("srilankaT20.csv",teamName="Sri Lanka",opposition=c("India", "Bangladesh"), homeOrAway=c("all"), matchType="T20", plot=TRUE)

4c. Plot the time line of wins vs losses of T20 teams against opposition at different venues during an interval

#Plot the time line of Sri Lanka T20 team agaibst all opposition
plotTimelineofWinsLosses("srilankaT20.csv",team="Sri Lanka",opposition=c("Australia", "Pakistan"), startDate="2013-01-01", endDate="2019-01-01",  matchType="T20")

# Plot the time line of South Africa T20 between 2010 and 2015 against West Indies and Pakistan
plotTimelineofWinsLosses("southafricaT20.csv",team="South Africa",opposition=c("West Indies", "Pakistan"), startDate="2010-01-01", endDate="2015-01-01",  matchType="T20")

My book ‘Cricket analytics with cricketr and cricpy’ is now on Amazon

‘Cricket analytics with cricketr and cricpy – Analytics harmony with R and Python’ is now available on Amazon in both paperback ($21.99) and kindle ($9.99/Rs 449) versions. The book includes analysis of cricketers using both my R package ‘cricketr’ and my python package ‘cricpy’ for all formats of the game namely Test, ODI and T20. Both packages use data from ESPN Cricinfo Statsguru. The paperback is available on Amazon for $21.99 and the kindle version is available for $9.99/Rs 449

Pick up your copy today!

The book includes the following chapters

CONTENTS

Introduction 7
1. Cricket analytics with cricketr 9
1.1. Introducing cricketr! : An R package to analyze performances of cricketers 10
1.2. Taking cricketr for a spin – Part 1 48
1.2. cricketr digs the Ashes! 69
1.3. cricketr plays the ODIs! 97
1.4. cricketr adapts to the Twenty20 International! 139
1.5. Sixer – R package cricketr’s new Shiny avatar 168
1.6. Re-introducing cricketr! : An R package to analyze performances of cricketers 178
1.7. cricketr sizes up legendary All-rounders of yesteryear 233
1.8. cricketr flexes new muscles: The final analysis 277
1.9. The Clash of the Titans in Test and ODI cricket 300
1.10. Analyzing performances of cricketers using cricketr template 338
2. Cricket analytics with cricpy 352
2.1 Introducing cricpy:A python package to analyze performances of cricketers 353
2.2 Cricpy takes a swing at the ODIs 405
Analysis of Top 4 batsman 448
2.3 Cricpy takes guard for the Twenty20s 449
2.4 Analyzing batsmen and bowlers with cricpy template 490
9. Average runs against different opposing teams 493
3. Other cricket posts in R 500
3.1 Analyzing cricket’s batting legends – Through the mirage with R 500
3.2 Mirror, mirror … the best batsman of them all? 527
4. Appendix 541
Cricket analysis with Machine Learning using Octave 541
4.1 Informed choices through Machine Learning – Analyzing Kohli, Tendulkar and Dravid 542
4.2 Informed choices through Machine Learning-2 Pitting together Kumble, Kapil, Chandra 555
Further reading 569
Important Links 570

Also see
1. My book “Deep Learning from first principles” now on Amazon
2. Practical Machine Learning with R and Python – Part 1
3. Revisiting World Bank data analysis with WDI and gVisMotionChart
4. Natural language processing: What would Shakespeare say?
5. Optimal Cloud Computing
6. Pitching yorkpy … short of good length to IPL – Part 1
7. Computer Vision: Ramblings on derivatives, histograms and contours

To see all posts click Index of posts