yorkr crashes the IPL party! – Part 2
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Most people say that it is the intellect which makes a great scientist. They are wrong: it is character.
Albert Einstein
*Science is organized knowledge. Wisdom is organized life.“*
Immanuel Kant
If I have seen further, it is by standing on the shoulders of giants
Isaac Newton
Valid criticism does you a favor.
Carl Sagan
Introduction
In this post, my R package ‘yorkr’, continues to bat in the IPL Twenty20s. This post is a continuation of my earlier post – yorkr crashes the IPL party ! – Part 1. This post deals with Class 2 functions namely the performances of an IPL team in all T20 matches against another IPL team for e.g all T20 matches of Chennai Super Kings vs Royal Challengers Bangalore or Kochi Tuskers Kerala vs Mumbai Indians etc.
You can clone/fork the code for my package yorkr from Github at yorkr
This post has also been published at RPubs IPLT20-Part2 and can also be downloaded as a PDF document from IPLT20-Part2.pdf
The list of function in Class 2 are
- teamBatsmenPartnershiOppnAllMatches()
- teamBatsmenPartnershipOppnAllMatchesChart()
- teamBatsmenVsBowlersOppnAllMatches()
- teamBattingScorecardOppnAllMatches()
- teamBowlingPerfOppnAllMatches()
- teamBowlersWicketsOppnAllMatches()
- teamBowlersVsBatsmenOppnAllMatches()
- teamBowlersWicketKindOppnAllMatches()
- teamBowlersWicketRunsOppnAllMatches()
- plotWinLossBetweenTeams()
1. Install the package from CRAN
library(yorkr) rm(list=ls())
2. Get data for all T20 matches between 2 teams
We can get all IPL T20 matches between any 2 teams using the function below. The dir parameter should point to the folder which has the IPL T20 RData files of the individual matches. This function creates a data frame of all the IPL T20 matches and also saves the dataframe as RData. The function below gets all matches between India and Australia
setwd("C:/software/cricket-package/york-test/yorkrData/IPL/IPL-T20-matches") matches <- getAllMatchesBetweenTeams("Sunrisers Hyderabad","Royal Challengers Bangalore",dir=".") dim(matches) ## [1] 1320 25
I have however already saved the IPL Twenty20 matches for all possible combinations of opposing IPL Teams. The data for these matches for the individual teams/countries can be obtained from Github at in the folder IPL-T20-allmatches-between-two-teams
Note: You will need to use the function below for future matches! The data in Cricsheet are from 2008 -2015
3. Save data for all matches between all combination of 2 teams
This can be done locally using the function below. You could use this function to combine all IPL Twenty20 matches between any 2 IPL teams into a single dataframe and save it in the current folder. The current implementation expects that the the RData files of individual matches are in ../data folder. Since I already have converted this I will not be running this again
# Available in yorkr_0.0.5. Can be installed from Github though! #saveAllMatchesBetween2IPLTeams()
4. Load data directly for all matches between 2 IPL teams
As in my earlier post I pick all IPL Twenty20 matches between 2 random IPL teams. I load the data directly from the stored RData files. When we load the Rdata file a “matches” object will be created. This object can be stored for the apporpriate teams as below
# Load T20 matches between 2 IPL teams setwd("C:/software/cricket-package/york-test/yorkrData/IPL/IPL-T20-allmatches-between-two-teams") load("Chennai Super Kings-Delhi Daredevils-allMatches.RData") csk_dd_matches <- matches load("Deccan Chargers-Kolkata Knight Riders-allMatches.RData") dc_kkr_matches <- matches load("Mumbai Indians-Pune Warriors-allMatches.RData") mi_pw_matches <- matches load("Rajasthan Royals-Sunrisers Hyderabad-allMatches.RData") rr_sh_matches <- matches load("Kings XI Punjab-Royal Challengers Bangalore-allMatches.RData") kxip_rcb_matches <-matches load("Chennai Super Kings-Kochi Tuskers Kerala-allMatches.RData") csk_ktk_matches <-matches
5. Team Batsmen partnership in Twenty20 (all matches with opposing IPL team)
This function will create a report of the batting partnerships in the IPL teams for the matches between the teams. The report can be brief or detailed depending on the parameter ‘report’. As can be seen M S Dhoni tops the list for CSK, followed by Raina and then Murali Vijay for matches against Delhi Daredevils. For the Delhi Daredevils it is V Sehawag followed by Gambhir.
m<- teamBatsmenPartnershiOppnAllMatches(csk_dd_matches,'Chennai Super Kings',report="summary") m ## Source: local data frame [29 x 2] ## ## batsman totalRuns ## (fctr) (dbl) ## 1 MS Dhoni 364 ## 2 SK Raina 335 ## 3 M Vijay 290 ## 4 S Badrinath 185 ## 5 ML Hayden 181 ## 6 MEK Hussey 169 ## 7 F du Plessis 100 ## 8 S Vidyut 94 ## 9 DR Smith 81 ## 10 JA Morkel 80 ## .. ... ... m<- teamBatsmenPartnershiOppnAllMatches(csk_dd_matches,'Delhi Daredevils',report="summary") m ## Source: local data frame [53 x 2] ## ## batsman totalRuns ## (fctr) (dbl) ## 1 V Sehwag 233 ## 2 G Gambhir 200 ## 3 DA Warner 134 ## 4 AB de Villiers 133 ## 5 KD Karthik 129 ## 6 DPMD Jayawardene 89 ## 7 JA Morkel 81 ## 8 TM Dilshan 79 ## 9 S Dhawan 78 ## 10 SS Iyer 77 ## .. ... ... m <-teamBatsmenPartnershiOppnAllMatches(dc_kkr_matches,'Deccan Chargers',report="summary") m ## Source: local data frame [29 x 2] ## ## batsman totalRuns ## (fctr) (dbl) ## 1 AC Gilchrist 166 ## 2 HH Gibbs 145 ## 3 RG Sharma 116 ## 4 S Dhawan 111 ## 5 A Symonds 100 ## 6 Y Venugopal Rao 92 ## 7 B Chipli 60 ## 8 DB Ravi Teja 54 ## 9 TL Suman 53 ## 10 VVS Laxman 32 ## .. ... ... m <-teamBatsmenPartnershiOppnAllMatches(mi_pw_matches,'Mumbai Indians',report="detailed") m[1:30,] ## batsman nonStriker partnershipRuns totalRuns ## 1 SR Tendulkar JEC Franklin 24 152 ## 2 SR Tendulkar AT Rayudu 46 152 ## 3 SR Tendulkar RG Sharma 2 152 ## 4 SR Tendulkar KD Karthik 20 152 ## 5 SR Tendulkar RT Ponting 39 152 ## 6 SR Tendulkar AC Blizzard 12 152 ## 7 SR Tendulkar RJ Peterson 9 152 ## 8 RG Sharma SR Tendulkar 3 135 ## 9 RG Sharma JEC Franklin 0 135 ## 10 RG Sharma AT Rayudu 34 135 ## 11 RG Sharma A Symonds 19 135 ## 12 RG Sharma KD Karthik 19 135 ## 13 RG Sharma KA Pollard 47 135 ## 14 RG Sharma TL Suman 7 135 ## 15 RG Sharma GJ Maxwell 6 135 ## 16 KD Karthik SR Tendulkar 8 108 ## 17 KD Karthik JEC Franklin 32 108 ## 18 KD Karthik AT Rayudu 3 108 ## 19 KD Karthik RG Sharma 50 108 ## 20 KD Karthik SL Malinga 10 108 ## 21 KD Karthik PP Ojha 0 108 ## 22 KD Karthik RJ Peterson 4 108 ## 23 KD Karthik NLTC Perera 1 108 ## 24 AT Rayudu SR Tendulkar 54 92 ## 25 AT Rayudu RG Sharma 37 92 ## 26 AT Rayudu KD Karthik 1 92 ## 27 JEC Franklin SR Tendulkar 31 63 ## 28 JEC Franklin RG Sharma 1 63 ## 29 JEC Franklin KD Karthik 15 63 ## 30 JEC Franklin SA Yadav 10 63 m <-teamBatsmenPartnershiOppnAllMatches(rr_sh_matches,'Sunrisers Hyderabad',report="summary") m ## Source: local data frame [23 x 2] ## ## batsman totalRuns ## (fctr) (dbl) ## 1 S Dhawan 168 ## 2 DJG Sammy 95 ## 3 EJG Morgan 90 ## 4 DA Warner 83 ## 5 NV Ojha 50 ## 6 KL Rahul 40 ## 7 RS Bopara 40 ## 8 DW Steyn 31 ## 9 CL White 31 ## 10 MC Henriques 29 ## .. ... ... m <-teamBatsmenPartnershiOppnAllMatches(kxip_rcb_matches,'Kings XI Punjab',report="summary") m ## Source: local data frame [47 x 2] ## ## batsman totalRuns ## (fctr) (dbl) ## 1 SE Marsh 246 ## 2 DA Miller 224 ## 3 RS Bopara 203 ## 4 AC Gilchrist 191 ## 5 Yuvraj Singh 126 ## 6 MS Bisla 103 ## 7 Mandeep Singh 100 ## 8 DJ Hussey 99 ## 9 Azhar Mahmood 96 ## 10 KC Sangakkara 88 ## .. ... ... m <-teamBatsmenPartnershiOppnAllMatches(csk_ktk_matches,'Kochi Tuskers Kerala',report="summary") m ## Source: local data frame [8 x 2] ## ## batsman totalRuns ## (fctr) (dbl) ## 1 BB McCullum 80 ## 2 BJ Hodge 70 ## 3 PA Patel 40 ## 4 RA Jadeja 35 ## 5 Y Gnaneswara Rao 19 ## 6 DPMD Jayawardene 16 ## 7 OA Shah 3 ## 8 KM Jadhav 1
6. Team batsmen partnership in Twenty20 (all matches with opposing IPL team)
This is plotted graphically in the charts below. The partnerships are shown. Note: All functions which create a plot also include a parameter plot=TRUE/FALSE. If you set this as FALSE then a data frame is returned. You can use the dataframe to create an interactive plot for the partnerships (mouse over) using packages like plotly,rcharts, googleVis or ggvis.
teamBatsmenPartnershipOppnAllMatchesChart(csk_dd_matches,'Chennai Super Kings',"Delhi Daredevils")
teamBatsmenPartnershipOppnAllMatchesChart(dc_kkr_matches,main="Kolkata Knight Riders",opposition="Deccan Chargers")
teamBatsmenPartnershipOppnAllMatchesChart(kxip_rcb_matches,"Royal Challengers Bangalore",opposition="Kings XI Punjab")
teamBatsmenPartnershipOppnAllMatchesChart(mi_pw_matches,"Mumbai Indians","Pune Warriors")
m <- teamBatsmenPartnershipOppnAllMatchesChart(rr_sh_matches,"Rajasthan Royals","Sunrisers Hyderabad",plot=FALSE) m[1:30,] ## batsman nonStriker runs ## 1 SR Watson STR Binny 60 ## 2 AM Rahane STR Binny 59 ## 3 STR Binny AM Rahane 45 ## 4 SR Watson R Dravid 42 ## 5 AM Rahane SV Samson 41 ## 6 BJ Hodge SV Samson 36 ## 7 CH Morris STR Binny 34 ## 8 AM Rahane SR Watson 31 ## 9 R Dravid SR Watson 30 ## 10 SV Samson AM Rahane 29 ## 11 SR Watson AM Rahane 27 ## 12 SPD Smith DJ Hooda 25 ## 13 SPD Smith JP Faulkner 24 ## 14 SPD Smith STR Binny 20 ## 15 R Dravid AM Rahane 18 ## 16 BJ Hodge JP Faulkner 18 ## 17 JP Faulkner SPD Smith 18 ## 18 SV Samson KK Nair 14 ## 19 JP Faulkner STR Binny 14 ## 20 SV Samson STR Binny 13 ## 21 SPD Smith AM Rahane 13 ## 22 SR Watson SPD Smith 12 ## 23 STR Binny JP Faulkner 12 ## 24 STR Binny SPD Smith 12 ## 25 JP Faulkner SV Samson 12 ## 26 KK Nair SV Samson 12 ## 27 JP Faulkner BJ Hodge 11 ## 28 SPD Smith SR Watson 10 ## 29 STR Binny SR Watson 9 ## 30 SV Samson BJ Hodge 9
7. Team batsmen versus bowler in Twenty20 (all matches with opposing IPL team)
The plots below provide information on how each of the top batsmen of the IPL teams fared against the opposition bowlers
# Adam Gilchrist was the top performer for Deccan Chargers teamBatsmenVsBowlersOppnAllMatches(dc_kkr_matches,"Deccan Chargers","Kolkata Knight Riders")
teamBatsmenVsBowlersOppnAllMatches(csk_dd_matches,"Delhi Daredevils","Chennai Super Kings",top=3)
m <- teamBatsmenVsBowlersOppnAllMatches(csk_ktk_matches,"Chennai Super Kings","Kochi Tuskers Kerala",top=10,plot=FALSE) m ## Source: local data frame [37 x 3] ## Groups: batsman [1] ## ## batsman bowler runs ## (fctr) (fctr) (dbl) ## 1 SK Raina RP Singh 6 ## 2 SK Raina S Sreesanth 18 ## 3 SK Raina M Muralitharan 1 ## 4 SK Raina R Vinay Kumar 4 ## 5 SK Raina NLTC Perera 11 ## 6 SK Raina RR Powar 13 ## 7 SK Raina RV Gomez 16 ## 8 WP Saha RP Singh 15 ## 9 WP Saha M Muralitharan 11 ## 10 WP Saha BJ Hodge 1 ## .. ... ... ... teamBatsmenVsBowlersOppnAllMatches(rr_sh_matches,"Sunrisers Hyderabad","Rajasthan Royals")
8. Team batsmen versus bowler in Twenty20(all matches with opposing IPL team)
The following tables gives the overall performances of the IPL team’s batsmen against the opposition.
#Chris Gayle followed by Virat Kohli tops for RCB a <-teamBattingScorecardOppnAllMatches(kxip_rcb_matches,main="Royal Challengers Bangalore",opposition="Kings XI Punjab") ## Total= 2444 a ## Source: local data frame [55 x 5] ## ## batsman ballsPlayed fours sixes runs ## (fctr) (int) (int) (int) (dbl) ## 1 CH Gayle 313 45 41 561 ## 2 V Kohli 296 39 8 344 ## 3 AB de Villiers 183 23 16 301 ## 4 JH Kallis 133 18 7 187 ## 5 R Dravid 90 11 1 105 ## 6 RV Uthappa 47 7 6 92 ## 7 CA Pujara 66 11 NA 70 ## 8 MK Pandey 50 5 3 67 ## 9 KP Pietersen 43 7 1 66 ## 10 MV Boucher 36 4 1 41 ## .. ... ... ... ... ... #Tendulkar & Rohit Sharma lead for Mumbai Indians teamBattingScorecardOppnAllMatches(mi_pw_matches,"Mumbai Indians","Pune Warriors") ## Total= 756 ## Source: local data frame [20 x 5] ## ## batsman ballsPlayed fours sixes runs ## (fctr) (int) (int) (int) (dbl) ## 1 SR Tendulkar 134 21 1 152 ## 2 RG Sharma 121 7 6 135 ## 3 KD Karthik 107 10 3 108 ## 4 AT Rayudu 93 8 1 92 ## 5 JEC Franklin 70 5 2 63 ## 6 KA Pollard 43 3 3 55 ## 7 TL Suman 16 3 3 36 ## 8 Harbhajan Singh 22 3 1 29 ## 9 SL Malinga 16 2 1 19 ## 10 A Symonds 18 2 NA 19 ## 11 RT Ponting 17 2 NA 14 ## 12 GJ Maxwell 7 1 1 13 ## 13 RJ Peterson 13 1 NA 13 ## 14 AC Blizzard 6 1 NA 6 ## 15 PP Ojha 2 NA NA 1 ## 16 MM Patel 2 NA NA 1 ## 17 RE Levi 2 NA NA 0 ## 18 SA Yadav 4 NA NA 0 ## 19 NLTC Perera 4 NA NA 0 ## 20 DR Smith 1 NA NA 0 teamBattingScorecardOppnAllMatches(mi_pw_matches,"Pune Warriors","Mumbai Indians") ## Total= 714 ## Source: local data frame [28 x 5] ## ## batsman ballsPlayed fours sixes runs ## (fctr) (int) (int) (int) (dbl) ## 1 RV Uthappa 131 13 4 151 ## 2 MK Pandey 80 5 4 88 ## 3 Yuvraj Singh 62 3 6 77 ## 4 M Manhas 36 5 NA 42 ## 5 SPD Smith 38 4 NA 41 ## 6 MR Marsh 26 2 2 38 ## 7 M Kartik 21 2 1 25 ## 8 R Sharma 22 2 1 23 ## 9 TL Suman 15 5 NA 23 ## 10 WD Parnell 24 3 NA 22 ## .. ... ... ... ... ... teamBattingScorecardOppnAllMatches(csk_dd_matches,"Delhi Daredevils","Chennai Super Kings") ## Total= 1983 ## Source: local data frame [53 x 5] ## ## batsman ballsPlayed fours sixes runs ## (fctr) (int) (int) (int) (dbl) ## 1 V Sehwag 147 27 9 233 ## 2 G Gambhir 155 23 2 200 ## 3 DA Warner 130 11 2 134 ## 4 AB de Villiers 80 7 6 133 ## 5 KD Karthik 99 15 1 129 ## 6 DPMD Jayawardene 77 7 2 89 ## 7 JA Morkel 63 8 2 81 ## 8 TM Dilshan 65 8 3 79 ## 9 S Dhawan 58 8 2 78 ## 10 SS Iyer 56 11 1 77 ## .. ... ... ... ... ... teamBattingScorecardOppnAllMatches(rr_sh_matches,"Rajasthan Royals","Sunrisers Hyderabad") ## Total= 808 ## Source: local data frame [17 x 5] ## ## batsman ballsPlayed fours sixes runs ## (fctr) (int) (int) (int) (dbl) ## 1 SR Watson 97 22 4 148 ## 2 AM Rahane 145 17 1 148 ## 3 SPD Smith 81 11 2 103 ## 4 STR Binny 83 6 1 90 ## 5 SV Samson 83 3 4 76 ## 6 JP Faulkner 41 7 2 59 ## 7 BJ Hodge 37 2 5 55 ## 8 R Dravid 44 7 1 48 ## 9 CH Morris 11 2 3 34 ## 10 KK Nair 23 3 NA 17 ## 11 R Bhatia 10 1 NA 8 ## 12 DS Kulkarni 6 1 NA 7 ## 13 DJ Hooda 9 NA NA 7 ## 14 AM Nayar 3 1 NA 4 ## 15 PV Tambe 7 NA NA 3 ## 16 KW Richardson 2 NA NA 1 ## 17 DH Yagnik 4 NA NA 0
9. Team performances of IPL bowlers (all matches with opposing IPL team)
Like the function above the following tables provide the top IPL bowlers of the respective teams in the matches against the opposition.
#Piyush Chawla has the most wickets for KXIP against RCB teamBowlingPerfOppnAllMatches(kxip_rcb_matches,"Kings XI Punjab","Royal Challengers Bangalore") ## Source: local data frame [38 x 5] ## ## bowler overs maidens runs wickets ## (fctr) (int) (int) (dbl) (dbl) ## 1 PP Chawla 14 0 311 12 ## 2 IK Pathan 12 0 159 9 ## 3 YA Abdulla 9 1 103 8 ## 4 RJ Harris 5 0 87 7 ## 5 P Awana 11 0 149 6 ## 6 S Sreesanth 6 0 101 5 ## 7 Azhar Mahmood 8 0 74 5 ## 8 Sandeep Sharma 8 1 101 4 ## 9 AR Patel 5 0 94 4 ## 10 VRV Singh 6 0 70 4 ## .. ... ... ... ... ... #Ashwin is the highest wicket takes for CSK against DD teamBowlingPerfOppnAllMatches(csk_dd_matches,main="Chennai Super Kings",opposition="Delhi Daredevils") ## Source: local data frame [26 x 5] ## ## bowler overs maidens runs wickets ## (fctr) (int) (int) (dbl) (dbl) ## 1 R Ashwin 9 0 233 17 ## 2 JA Morkel 11 0 338 10 ## 3 DJ Bravo 5 0 135 8 ## 4 SB Jakati 4 0 140 6 ## 5 L Balaji 10 0 117 6 ## 6 MM Sharma 1 0 99 6 ## 7 RA Jadeja 2 0 85 4 ## 8 IC Pandey 1 0 80 4 ## 9 BW Hilfenhaus 5 0 53 4 ## 10 A Nehra 1 0 25 4 ## .. ... ... ... ... ... teamBowlingPerfOppnAllMatches(dc_kkr_matches,"Deccan Chargers","Kolkata Knight Riders") ## Source: local data frame [26 x 5] ## ## bowler overs maidens runs wickets ## (fctr) (int) (int) (dbl) (dbl) ## 1 RP Singh 11 0 161 7 ## 2 PP Ojha 11 0 196 6 ## 3 WPUJC Vaas 4 0 67 5 ## 4 A Symonds 12 0 100 4 ## 5 DW Steyn 8 0 88 4 ## 6 A Mishra 8 0 68 3 ## 7 Jaskaran Singh 6 0 53 3 ## 8 SB Styris 7 0 79 2 ## 9 RJ Harris 4 0 20 2 ## 10 Harmeet Singh 10 0 84 1 ## .. ... ... ... ... ...
10. Team bowler’s wickets in IPL Twenty20 (all matches with opposing IPL team)
This provided a graphical plot of the tables above
# Dirk Nannes and Umesh Yadav top for DD against CSK teamBowlersWicketsOppnAllMatches(csk_dd_matches,"Delhi Daredevils","Chennai Superkings")
# SL Malinga and Munaf Patel lead in MI vs PW clashes teamBowlersWicketsOppnAllMatches(mi_pw_matches,"Mumbai Indians","Pune Warrors")
teamBowlersWicketsOppnAllMatches(dc_kkr_matches,"Kolkata Knight Riders","Deccan Chargers",top=10)
m <-teamBowlersWicketsOppnAllMatches(kxip_rcb_matches,"Royal Challengers Bangalore","Kings XI Punjab",plot=FALSE) m ## Source: local data frame [20 x 2] ## ## bowler wickets ## (fctr) (int) ## 1 S Aravind 8 ## 2 Z Khan 7 ## 3 MA Starc 7 ## 4 HV Patel 6 ## 5 P Kumar 5 ## 6 YS Chahal 5 ## 7 JH Kallis 4 ## 8 R Vinay Kumar 3 ## 9 A Kumble 3 ## 10 CH Gayle 3 ## 11 AB McDonald 3 ## 12 VR Aaron 3 ## 13 DW Steyn 2 ## 14 CK Langeveldt 2 ## 15 DL Vettori 2 ## 16 M Kartik 2 ## 17 RE van der Merwe 2 ## 18 R Rampaul 1 ## 19 JA Morkel 1 ## 20 AB Dinda 1
11. Team bowler vs batsmen in Twenty20(all matches with opposing IPL team)
These plots show how the IPL bowlers fared against the batsmen. It shows which of the opposing IPL teams batsmen were able to score the most runs
teamBowlersVsBatsmenOppnAllMatches(rr_sh_matches,'Rajasthan Royals',"Sunrisers Hyderabd",top=5)
teamBowlersVsBatsmenOppnAllMatches(kxip_rcb_matches,"Kings XI Punjab","Royal Challengers Bangalore",top=3)
teamBowlersVsBatsmenOppnAllMatches(dc_kkr_matches,"Deccan Chargers","Kolkata Knight Riders")
12. Team bowler’s wicket kind in Twenty20(caught,bowled,etc) (all matches with opposing IPL team)
The charts below show the wicket kind taken by the bowler of the IPL team(caught, bowled, lbw etc)
teamBowlersWicketKindOppnAllMatches(csk_dd_matches,"Delhi Daredevils","Chennai Super Kings",plot=TRUE)
m <- teamBowlersWicketKindOppnAllMatches(mi_pw_matches,"Pune Warriors","Mumbai Indians",plot=FALSE) m[1:30,] ## bowler wicketKind wicketPlayerOut runs ## 1 SB Wagh caught JEC Franklin 31 ## 2 R Sharma caught SR Tendulkar 64 ## 3 AC Thomas caught AT Rayudu 69 ## 4 M Kartik stumped RE Levi 70 ## 5 AB Dinda caught AT Rayudu 150 ## 6 AB Dinda caught RG Sharma 150 ## 7 M Kartik stumped KD Karthik 70 ## 8 MN Samuels bowled SA Yadav 21 ## 9 R Sharma bowled KA Pollard 64 ## 10 AB Dinda caught JEC Franklin 150 ## 11 WD Parnell caught SL Malinga 64 ## 12 AB Dinda lbw Harbhajan Singh 150 ## 13 Yuvraj Singh caught RT Ponting 61 ## 14 AJ Finch caught SR Tendulkar 11 ## 15 MR Marsh lbw KD Karthik 24 ## 16 AC Thomas caught AC Blizzard 69 ## 17 Yuvraj Singh caught SR Tendulkar 61 ## 18 Yuvraj Singh caught AT Rayudu 61 ## 19 R Sharma caught RG Sharma 64 ## 20 R Sharma caught TL Suman 64 ## 21 JE Taylor caught A Symonds 34 ## 22 JE Taylor caught KA Pollard 34 ## 23 B Kumar caught JEC Franklin 50 ## 24 MJ Clarke run out RG Sharma 9 ## 25 A Nehra caught SR Tendulkar 19 ## 26 A Nehra caught RJ Peterson 19 ## 27 B Kumar bowled AT Rayudu 50 ## 28 A Nehra run out NLTC Perera 19 ## 29 AB Dinda caught Harbhajan Singh 150 ## 30 WD Parnell run out SL Malinga 64 teamBowlersWicketKindOppnAllMatches(dc_kkr_matches,"Kolkata Knight Riders",'Deccan Chargers',plot=TRUE)
13. Team bowler’s wicket taken and runs conceded in Twenty20(all matches with opposing IPL team)
teamBowlersWicketRunsOppnAllMatches(csk_ktk_matches,"Kochi Tuskers Kerala","Chennai Super Kings")
m <-teamBowlersWicketRunsOppnAllMatches(mi_pw_matches,"Mumbai Indians","Pune Warriors",plot=FALSE) m[1:30,] ## Source: local data frame [30 x 5] ## ## bowler overs maidens runs wickets ## (fctr) (int) (int) (dbl) (dbl) ## 1 AG Murtaza 4 0 18 2 ## 2 SL Malinga 9 1 143 10 ## 3 AN Ahmed 5 0 40 4 ## 4 MM Patel 6 1 88 7 ## 5 KA Pollard 6 0 99 5 ## 6 JEC Franklin 4 0 64 1 ## 7 Harbhajan Singh 7 0 85 6 ## 8 PP Ojha 8 0 95 4 ## 9 MG Johnson 5 0 41 4 ## 10 R Dhawan 1 0 27 0 ## .. ... ... ... ... ...
14. Plot of wins vs losses between teams in IPL T20 confrontations
setwd("C:/software/cricket-package/york-test/yorkrData/IPL/IPL-T20-matches") plotWinLossBetweenTeams("Chennai Super Kings","Delhi Daredevils")
plotWinLossBetweenTeams("Deccan Chargers","Kolkata Knight Riders",".")
plotWinLossBetweenTeams('Kings XI Punjab',"Royal Challengers Bangalore",".")
plotWinLossBetweenTeams("Mumbai Indians","Pune Warriors",".")
plotWinLossBetweenTeams('Rajasthan Royals',"Sunrisers Hyderabad",".")
plotWinLossBetweenTeams('Chennai Super Kings',"Mumbai Indians",".")
Conclusion
This post included all functions for all IPL Twenty20 matches between any 2 IPL teams. As before the data frames are already available. You can load the data and begin to use them. If more insights from the dataframe are possible do go ahead. But please do attribute the source to Cricheet (http://cricsheet.org), my package yorkr and my blog. Do give the functions a spin for yourself!
You may also like
- yorkr pads up for the Twenty20s: Part 1- Analyzing team“s match performance
- yorkr pads up for the Twenty20s:Part 4- Individual batting and bowling performances
- Introducing cricket package yorkr: Part 2-Trapped leg before wicket!
- Introducing cricket package yorkr:Part 4-In the block hole!
- Introducing cricketr! : An R package to analyze performances of cricketers
- Cricket analytics with cricketr
- OpenCV: Fun with filters and convolution
- To Hadoop, or not to Hadoop
- Close encounters with the future
- Presentation on ‘Evolution to LTE’
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.