神刀安全网

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

(This article was first published on R – Giga thoughts … , and kindly contributed toR-bloggers)

Alice:“How long is forever”? White Rabbit:“Sometimes, just one second.”

Alice :“Where should I go?” The Cheshire Cat: “That depends on where you want to end up.”

“I’m not strange, weird, off, nor crazy, my reality is just different from yours.”

        Alice through the looking glass - Lewis Caroll

Introduction

In this post, my R package ‘yorkr’, continues to bat in the Twenty20s. This post is a continuation of my earlier post – yorkr pads up for the Twenty20s: Part 1- Analyzing team“s match performance . This post deals with Class 2 functions namely the performances of a team in all T20 matches against a single opposition for e.g all T20 matches of India-Australia, Pakistan-West Indies etc. You can clone/fork the code for my package yorkr from Github at yorkr

This post has also been published at RPubs yorkrT20-Part2 and can also be downloaded as a PDF document from yorkrT20-Part2.pdf

The list of function in Class 2 are

  1. teamBatsmenPartnershiOppnAllMatches()
  2. teamBatsmenPartnershipOppnAllMatchesChart()
  3. teamBatsmenVsBowlersOppnAllMatches()
  4. teamBattingScorecardOppnAllMatches()
  5. teamBowlingPerfOppnAllMatches()
  6. teamBowlersWicketsOppnAllMatches()
  7. teamBowlersVsBatsmenOppnAllMatches()
  8. teamBowlersWicketKindOppnAllMatches()
  9. teamBowlersWicketRunsOppnAllMatches()
  10. 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 T20 matches between any 2 teams using the function below. The dir parameter should point to the folder which has the T20 RData files of the individual matches. This function creates a data frame of all the 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/Twenty20/T20-matches") matches <- getAllMatchesBetweenTeams("Australia","India",dir=".") dim(matches)
## [1] 2829   25

I have however already saved the Twenty20 matches for all possible combination of opposing countries. The data for these matches for the individual teams/countries can be obtained from Github at in the folder T20-allmatches-between-two-teams

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 Twenty20 matches between any 2 teams into a single dataframe and save it in the current folder. The current implementation expectes 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

#saveAllMatchesBetweenTeams()

4. Load data directly for all matches between 2 teams

As in my earlier post I pick all Twenty20 matches between 2 random 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 teams setwd("C:/software/cricket-package/york-test/yorkrData/Twenty20/T20-allmatches-between-two-teams") load("India-Australia-allMatches.RData") aus_ind_matches <- matches dim(aus_ind_matches)
## [1] 2829   25
load("England-New Zealand-allMatches.RData") eng_nz_matches <- matches dim(eng_nz_matches)
## [1] 2760   25
load("Pakistan-South Africa-allMatches.RData") pak_sa_matches <- matches dim(pak_sa_matches)
## [1] 2308   25
load("Sri Lanka-West Indies-allMatches.RData") sl_wi_matches <- matches dim(sl_wi_matches)
## [1] 1909   25
load("Bangladesh-Ireland-allMatches.RData") ban_ire_matches <-matches dim(ban_ire_matches)
## [1] 479  25
load("Scotland-Canada-allMatches.RData") sco_can_matches <-matches dim(sco_can_matches)
## [1] 250  25
load("Netherlands-Afghanistan-allMatches.RData") nl_afg_matches <- matches dim(nl_afg_matches)
## [1] 927  25

5. Team Batsmen partnership in Twenty20 (all matches with opposition)

This function will create a report of the batting partnerships in the teams. The report can be brief or detailed depending on the parameter ‘report’. The top batsmen in India-Australia clashes are Shane Watson & AJ Finch from Australia and Virat Kohli & Yuvraj Singh of India.

m<- teamBatsmenPartnershiOppnAllMatches(aus_ind_matches,'Australia',report="summary") m
## Source: local data frame [40 x 2] ##  ##         batsman totalRuns ##          (fctr)     (dbl) ## 1     SR Watson       284 ## 2      AJ Finch       249 ## 3     DA Warner       204 ## 4       MS Wade       125 ## 5     DJ Hussey       101 ## 6     ML Hayden        79 ## 7    RT Ponting        76 ## 8     MJ Clarke        65 ## 9     A Symonds        63 ## 10 AC Gilchrist        59 ## ..          ...       ...
m <-teamBatsmenPartnershiOppnAllMatches(aus_ind_matches,'India',report="summary") m
## Source: local data frame [23 x 2] ##  ##         batsman totalRuns ##          (fctr)     (dbl) ## 1       V Kohli       319 ## 2  Yuvraj Singh       262 ## 3     RG Sharma       252 ## 4      MS Dhoni       213 ## 5     G Gambhir       198 ## 6      SK Raina       160 ## 7      S Dhawan       105 ## 8    RV Uthappa        70 ## 9     IK Pathan        57 ## 10     V Sehwag        41 ## ..          ...       ...
m <-teamBatsmenPartnershiOppnAllMatches(aus_ind_matches,'Australia',report="detailed") m[1:30,]
##      batsman   nonStriker partnershipRuns totalRuns ## 1  SR Watson     AJ Finch              21       284 ## 2  SR Watson   GJ Maxwell               3       284 ## 3  SR Watson    DA Warner             127       284 ## 4  SR Watson     SE Marsh              41       284 ## 5  SR Watson      TM Head              63       284 ## 6  SR Watson      CA Lynn              23       284 ## 7  SR Watson   UT Khawaja               2       284 ## 8  SR Watson  CT Bancroft               4       284 ## 9   AJ Finch    BJ Haddin              15       249 ## 10  AJ Finch NJ Maddinson              21       249 ## 11  AJ Finch    SR Watson              25       249 ## 12  AJ Finch   GJ Maxwell              12       249 ## 13  AJ Finch MC Henriques              21       249 ## 14  AJ Finch    DA Warner              44       249 ## 15  AJ Finch    DJ Hussey              25       249 ## 16  AJ Finch      MS Wade               1       249 ## 17  AJ Finch     SE Marsh              66       249 ## 18  AJ Finch    SPD Smith              16       249 ## 19  AJ Finch      TM Head               0       249 ## 20  AJ Finch      CA Lynn               3       249 ## 21 DA Warner     AJ Finch              30       204 ## 22 DA Warner    SR Watson             110       204 ## 23 DA Warner   GJ Maxwell              11       204 ## 24 DA Warner    DJ Hussey              22       204 ## 25 DA Warner     CL White               6       204 ## 26 DA Warner      MS Wade              25       204 ## 27   MS Wade     AJ Finch               2       125 ## 28   MS Wade  JP Faulkner               6       125 ## 29   MS Wade    DA Warner              12       125 ## 30   MS Wade    DJ Hussey              54       125
m <-teamBatsmenPartnershiOppnAllMatches(pak_sa_matches,'Pakistan',report="summary") m
## Source: local data frame [24 x 2] ##  ##            batsman totalRuns ##             (fctr)     (dbl) ## 1       Umar Akmal       255 ## 2  Mohammad Hafeez       205 ## 3    Shahid Afridi       165 ## 4    Ahmed Shehzad        85 ## 5     Shoaib Malik        80 ## 6    Nasir Jamshed        69 ## 7    Misbah-ul-Haq        63 ## 8     Kamran Akmal        62 ## 9     Abdul Razzaq        62 ## 10  Sohaib Maqsood        41 ## ..             ...       ...
m <-teamBatsmenPartnershiOppnAllMatches(eng_nz_matches,'England',report="summary") m
## Source: local data frame [35 x 2] ##  ##           batsman totalRuns ##            (fctr)     (dbl) ## 1       LJ Wright       273 ## 2        AD Hales       194 ## 3         MJ Lumb       188 ## 4      EJG Morgan       152 ## 5      JC Buttler       140 ## 6    KP Pietersen       112 ## 7         OA Shah        91 ## 8  PD Collingwood        86 ## 9         IR Bell        73 ## 10        JE Root        68 ## ..            ...       ...
m <-teamBatsmenPartnershiOppnAllMatches(sl_wi_matches,'Sri Lanka',report="summary") m[1:20,]
## Source: local data frame [20 x 2] ##  ##             batsman totalRuns ##              (fctr)     (dbl) ## 1        TM Dilshan       334 ## 2  DPMD Jayawardene       202 ## 3     KC Sangakkara       135 ## 4     ST Jayasuriya       111 ## 5        AD Mathews        98 ## 6       MDKJ Perera        78 ## 7  DSNFG Jayasuriya        66 ## 8   HDRL Thirimanne        48 ## 9      LD Chandimal        41 ## 10  KMDN Kulasekara        30 ## 11        LPC Silva        18 ## 12        J Mubarak        15 ## 13  TAM Siriwardana        15 ## 14    CK Kapugedera         8 ## 15       SL Malinga         7 ## 16       S Prasanna         6 ## 17      BMAJ Mendis         3 ## 18      NLTC Perera         3 ## 19  SMSM Senanayake         3 ## 20     PVD Chameera         3
m <- teamBatsmenPartnershiOppnAllMatches(ban_ire_matches,"Ireland",report="summary") m
## Source: local data frame [11 x 2] ##  ##            batsman totalRuns ##             (fctr)     (dbl) ## 1        GC Wilson        51 ## 2  WTS Porterfield        49 ## 3       NJ O'Brien        48 ## 4       KJ O'Brien        39 ## 5        JF Mooney        18 ## 6      MC Sorensen        12 ## 7         EC Joyce        11 ## 8      DT Johnston         7 ## 9      PR Stirling         4 ## 10         JP Bray         2 ## 11       AR Cusack         1

6. Team batsmen partnership in Twenty20 (all matches with opposition)

This is plotted graphically in the charts below. Kohli & Yuvraj top the list for India.

teamBatsmenPartnershipOppnAllMatchesChart(aus_ind_matches,"India","Australia")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

teamBatsmenPartnershipOppnAllMatchesChart(pak_sa_matches,main="South Africa",opposition="Pakistan")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

m<- teamBatsmenPartnershipOppnAllMatchesChart(eng_nz_matches,"New Zealand",opposition="England",plot=FALSE) m[1:30,]
##          batsman    nonStriker runs ## 1  HD Rutherford    MJ Guptill   69 ## 2  HD Rutherford   BB McCullum   61 ## 3    BB McCullum    MJ Guptill   53 ## 4     MJ Guptill HD Rutherford   52 ## 5    BB McCullum KS Williamson   51 ## 6    BB McCullum HD Rutherford   49 ## 7    LRPL Taylor   BB McCullum   49 ## 8    BB McCullum   LRPL Taylor   46 ## 9     MJ Guptill   BB McCullum   41 ## 10     SB Styris   CD McMillan   40 ## 11   CD McMillan      JDP Oram   38 ## 12  JEC Franklin   LRPL Taylor   33 ## 13   LRPL Taylor KS Williamson   32 ## 14 KS Williamson   LRPL Taylor   32 ## 15     SB Styris   LRPL Taylor   31 ## 16   LRPL Taylor     SB Styris   30 ## 17   BB McCullum      JD Ryder   29 ## 18      JDP Oram      JS Patel   28 ## 19      JD Ryder   BB McCullum   27 ## 20   BB McCullum  JEC Franklin   26 ## 21      DR Flynn     SB Styris   22 ## 22    TWM Latham   LRPL Taylor   22 ## 23 KS Williamson    MJ Santner   21 ## 24  JEC Franklin   NL McCullum   21 ## 25       C Munro    MJ Guptill   21 ## 26   LRPL Taylor        JM How   19 ## 27   LRPL Taylor    MJ Guptill   19 ## 28   CD McMillan     SB Styris   19 ## 29    MJ Guptill  JEC Franklin   19 ## 30   BB McCullum     SB Styris   18
teamBatsmenPartnershipOppnAllMatchesChart(sl_wi_matches,"Sri Lanka","West Indies")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

teamBatsmenPartnershipOppnAllMatchesChart(ban_ire_matches,"Bangladesh","Ireland")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

7. Team batsmen versus bowler in Twenty20 (all matches with opposition)

The plots below provide information on how each of the top batsmen fared against the opposition bowlers

teamBatsmenVsBowlersOppnAllMatches(aus_ind_matches,"India","Australia")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

teamBatsmenVsBowlersOppnAllMatches(pak_sa_matches,"South Africa","Pakistan",top=3)

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

m <- teamBatsmenVsBowlersOppnAllMatches(eng_nz_matches,"England","New Zealnd",top=10,plot=FALSE) m
## Source: local data frame [113 x 3] ## Groups: batsman [1] ##  ##      batsman       bowler  runs ##       (fctr)       (fctr) (dbl) ## 1  LJ Wright      SE Bond     1 ## 2  LJ Wright MR Gillespie    17 ## 3  LJ Wright     JDP Oram     4 ## 4  LJ Wright    CS Martin    19 ## 5  LJ Wright   DL Vettori    18 ## 6  LJ Wright    SB Styris    14 ## 7  LJ Wright     KD Mills    23 ## 8  LJ Wright     MJ Mason     4 ## 9  LJ Wright  NL McCullum    42 ## 10 LJ Wright    IG Butler    15 ## ..       ...          ...   ...
teamBatsmenVsBowlersOppnAllMatches(sl_wi_matches,"Sri Lanka","West Indies")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

teamBatsmenVsBowlersOppnAllMatches(ban_ire_matches,"Bangladesh","Ireland")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

8. Team batsmen versus bowler in Twenty20(all matches with opposition)

The following tables gives the overall performances of the country’s batsmen against the opposition. For India-Australia matches Virat Kohli, Yuvraj Singh and Rohit Sharma lead the way. For Australia it is Shane Watson, AJ Finch and DA Warner. In South Africa- Pakistan matches it is JP Duminy & De Kock respectively

a <-teamBattingScorecardOppnAllMatches(aus_ind_matches,main="India",opposition="Australia")
## Total= 1787
a
## Source: local data frame [23 x 5] ##  ##         batsman ballsPlayed fours sixes  runs ##          (fctr)       (int) (int) (int) (dbl) ## 1       V Kohli         225    27     7   319 ## 2  Yuvraj Singh         151    21    18   262 ## 3     RG Sharma         175    20    12   252 ## 4      MS Dhoni         189    15     7   213 ## 5     G Gambhir         174    25     1   198 ## 6      SK Raina         117    17     3   160 ## 7      S Dhawan          65    12     3   105 ## 8    RV Uthappa          54     7     3    70 ## 9     IK Pathan          58     2     1    57 ## 10     V Sehwag          38     5     1    41 ## ..          ...         ...   ...   ...   ...
teamBattingScorecardOppnAllMatches(aus_ind_matches,"Australia","India")
## Total= 1767
## Source: local data frame [40 x 5] ##  ##         batsman ballsPlayed fours sixes  runs ##          (fctr)       (int) (int) (int) (dbl) ## 1     SR Watson         173    16    20   284 ## 2      AJ Finch         164    33     5   249 ## 3     DA Warner         134    14    14   204 ## 4       MS Wade          93     6     5   125 ## 5     DJ Hussey          81     5     6   101 ## 6     ML Hayden          63     5     6    79 ## 7    RT Ponting          52    13    NA    76 ## 8     MJ Clarke          54     3     1    65 ## 9     A Symonds          43     4     2    63 ## 10 AC Gilchrist          38     7     3    59 ## ..          ...         ...   ...   ...   ...
teamBattingScorecardOppnAllMatches(pak_sa_matches,"South Africa","Pakistan")
## Total= 1265
## Source: local data frame [27 x 5] ##  ##           batsman ballsPlayed fours sixes  runs ##            (fctr)       (int) (int) (int) (dbl) ## 1       JP Duminy         178    14     7   214 ## 2       Q de Kock         110    21     2   147 ## 3         HM Amla         114    17     2   146 ## 4  AB de Villiers         116    10     5   144 ## 5    F du Plessis         121     6     4   129 ## 6       JH Kallis          92     9     2    98 ## 7       CA Ingram          55     8     3    77 ## 8        GC Smith          78     9    NA    74 ## 9       DA Miller          54     7     2    73 ## 10  RK Kleinveldt           7     1     3    22 ## ..            ...         ...   ...   ...   ...
teamBattingScorecardOppnAllMatches(sl_wi_matches,"West Indies","Sri Lanka")
## Total= 1017
## Source: local data frame [20 x 5] ##  ##          batsman ballsPlayed fours sixes  runs ##           (fctr)       (int) (int) (int) (dbl) ## 1       DJ Bravo         173    17     9   218 ## 2     MN Samuels         132     9     8   157 ## 3   ADS Fletcher          74    10     7   109 ## 4       CH Gayle          91     9     2    76 ## 5     KA Pollard          61     6     2    65 ## 6      RR Sarwan          66     2    NA    61 ## 7       D Ramdin          30     3     2    47 ## 8      J Charles          51     3     3    46 ## 9      DJG Sammy          34     4    NA    45 ## 10    AD Russell          32    NA     4    44 ## 11   LMP Simmons          29     5    NA    33 ## 12     JE Taylor          23     2    NA    24 ## 13     SP Narine          15     2     1    23 ## 14 S Chanderpaul          28     1     1    19 ## 15      DR Smith          14     1     1    17 ## 16   XM Marshall          12     2    NA    14 ## 17       SJ Benn           8     1    NA     6 ## 18      D Bishoo           5     1    NA     6 ## 19      WW Hinds           7     1    NA     5 ## 20     JO Holder           4    NA    NA     2
teamBattingScorecardOppnAllMatches(eng_nz_matches,"England","New Zealand")
## Total= 1943
## Source: local data frame [35 x 5] ##  ##           batsman ballsPlayed fours sixes  runs ##            (fctr)       (int) (int) (int) (dbl) ## 1       LJ Wright         167    28    12   273 ## 2        AD Hales         125    22     7   194 ## 3         MJ Lumb         129    15    11   188 ## 4      EJG Morgan         141    12     5   152 ## 5      JC Buttler          83    16     5   140 ## 6    KP Pietersen          83    13     2   112 ## 7         OA Shah          68     6     4    91 ## 8  PD Collingwood          61     6     4    86 ## 9         IR Bell          60    11     1    73 ## 10        JE Root          45     8     1    68 ## ..            ...         ...   ...   ...   ...
teamBatsmenPartnershiOppnAllMatches(sco_can_matches,"Scotland","Canada")
## Source: local data frame [8 x 2] ##  ##         batsman totalRuns ##          (fctr)     (dbl) ## 1 RD Berrington        47 ## 2    KJ Coetzer        22 ## 3    JH Stander        21 ## 4      DF Watts        18 ## 5   R Flannigan        15 ## 6    CS MacLeod         2 ## 7        RM Haq         2 ## 8    PL Mommsen         0

9. Team performances of bowlers (all matches with opposition)

Like the function above the following tables provide the top bowlers of the countries in the matches against the oppoition. In India-Australia matches RA Jadeja leads, in Pakistan-South Africa matches Saeed Ajmal tops and so on.

teamBowlingPerfOppnAllMatches(aus_ind_matches,"India","Australia")
## Source: local data frame [26 x 5] ##  ##             bowler overs maidens  runs wickets ##             (fctr) (int)   (int) (dbl)   (dbl) ## 1        RA Jadeja    13       0   219       8 ## 2         R Ashwin    12       0   232       7 ## 3        JJ Bumrah     5       0   103       6 ## 4    R Vinay Kumar     6       0    79       6 ## 5         R Sharma     5       0    56       5 ## 6          A Nehra     9       0   127       4 ## 7     Yuvraj Singh     5       0    72       4 ## 8          B Kumar     5       0    42       4 ## 9        IK Pathan     5       0   115       3 ## 10 Harbhajan Singh     9       1    83       3 ## ..             ...   ...     ...   ...     ...
teamBowlingPerfOppnAllMatches(pak_sa_matches,main="Pakistan",opposition="South Africa")
## Source: local data frame [17 x 5] ##  ##             bowler overs maidens  runs wickets ##             (fctr) (int)   (int) (dbl)   (dbl) ## 1      Saeed Ajmal     8       1   202      10 ## 2  Mohammad Hafeez    10       0   178       9 ## 3    Shahid Afridi    11       0   200       6 ## 4         Umar Gul     3       0    93       6 ## 5    Sohail Tanvir     6       0   103       3 ## 6      Junaid Khan     4       0    75       3 ## 7    Shoaib Akhtar     1       0    65       3 ## 8    Mohammad Amir     1       0    63       2 ## 9   Bilawal Bhatti     5       0    54       2 ## 10    Abdur Rehman     1       0    53       2 ## 11    Yasir Arafat     3       0    25       2 ## 12    Abdul Razzaq     2       0    69       1 ## 13  Mohammad Irfan     3       0    46       1 ## 14       Anwar Ali     2       0    22       0 ## 15    Shoaib Malik     3       0    17       0 ## 16      Fawad Alam     1       0    15       0 ## 17      Raza Hasan     3       1    12       0
teamBowlingPerfOppnAllMatches(eng_nz_matches,"New Zealand","England")
## Source: local data frame [26 x 5] ##  ##            bowler overs maidens  runs wickets ##            (fctr) (int)   (int) (dbl)   (dbl) ## 1        KD Mills     8       0   199       5 ## 2  MJ McClenaghan    10       0   189       5 ## 3      TG Southee    13       0   183       5 ## 4      DL Vettori     1       0    91       5 ## 5    JEC Franklin     2       0    53       5 ## 6     NL McCullum     9       0   281       4 ## 7       CS Martin     6       0   116       4 ## 8         SE Bond     1       0    49       4 ## 9       IG Butler     1       0    95       3 ## 10      SB Styris     4       0    80       3 ## ..            ...   ...     ...   ...     ...
teamBowlingPerfOppnAllMatches(sl_wi_matches,"Sri Lanka","West Indies")
## Source: local data frame [16 x 5] ##  ##              bowler overs maidens  runs wickets ##              (fctr) (int)   (int) (dbl)   (dbl) ## 1        BAW Mendis     8       1    82      10 ## 2        SL Malinga     7       0   217       9 ## 3        AD Mathews     7       0    87       6 ## 4   TAM Siriwardana     4       0    58       5 ## 5   SMSM Senanayake     4       0    90       4 ## 6    M Muralitharan     1       0    76       4 ## 7   KMDN Kulasekara     7       0   158       2 ## 8      PVD Chameera     4       0    66       2 ## 9           I Udana     1       0    56       1 ## 10 DSNFG Jayasuriya     4       0    38       1 ## 11      BMAJ Mendis     2       0    32       1 ## 12      A Dananjaya     3       0    16       1 ## 13       S Prasanna     1       0    15       1 ## 14     HMRKB Herath     3       0    43       0 ## 15    ST Jayasuriya     1       0    34       0 ## 16      NLTC Perera     1       0    13       0

10. Team bowler’s wickets in Twenty20 (all matches with opposition)

This provided a graphical plot of the tables above

teamBowlersWicketsOppnAllMatches(aus_ind_matches,"India","Australia")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

teamBowlersWicketsOppnAllMatches(aus_ind_matches,"Australia","India")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

teamBowlersWicketsOppnAllMatches(pak_sa_matches,"South Africa","Pakistan",top=10)

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

m <-teamBowlersWicketsOppnAllMatches(eng_nz_matches,"England","Zealand",plot=FALSE) m
## Source: local data frame [20 x 2] ##  ##            bowler wickets ##            (fctr)   (int) ## 1       SCJ Broad      12 ## 2     JM Anderson       7 ## 3     JW Dernbach       7 ## 4        GP Swann       6 ## 5       LJ Wright       5 ## 6   RJ Sidebottom       4 ## 7         ST Finn       4 ## 8         MA Wood       4 ## 9  AD Mascarenhas       3 ## 10 PD Collingwood       3 ## 11      DJ Willey       3 ## 12       DL Maddy       2 ## 13     TT Bresnan       2 ## 14      BA Stokes       2 ## 15    JC Tredwell       2 ## 16     A Flintoff       1 ## 17      DR Briggs       1 ## 18      WB Rankin       1 ## 19      AU Rashid       1 ## 20        JE Root       1
teamBowlersWicketsOppnAllMatches(ban_ire_matches,"Bangladesh","Ireland",top=3)

11. Team bowler vs batsmen in Twenty20(all matches with opposition)

These plots show how the bowlers fared against the batsmen. It shows which of the opposing teams batsmen were able to score the most runs

teamBowlersVsBatsmenOppnAllMatches(aus_ind_matches,'India',"Australia",top=5)

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

teamBowlersVsBatsmenOppnAllMatches(pak_sa_matches,"Pakistan","South Africa",top=3)

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

teamBowlersVsBatsmenOppnAllMatches(eng_nz_matches,"England","New Zealand")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

teamBowlersVsBatsmenOppnAllMatches(eng_nz_matches,"New Zealand","England")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

12. Team bowler’s wicket kind in Twenty20(caught,bowled,etc) (all matches with opposition)

The charts below show the wicket kind taken by the bowler (caught, bowled, lbw etc)

teamBowlersWicketKindOppnAllMatches(aus_ind_matches,"India","Australia",plot=TRUE)

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

m <- teamBowlersWicketKindOppnAllMatches(aus_ind_matches,"Australia","India",plot=FALSE) m[1:30,]
##             bowler wicketKind wicketPlayerOut runs ## 1            B Lee     caught        V Sehwag  133 ## 2        MJ Clarke     caught      RV Uthappa   27 ## 3    BW Hilfenhaus     caught       G Gambhir   28 ## 4         CJ McKay     caught       RG Sharma   75 ## 5  NM Coulter-Nile     caught        SK Raina   44 ## 6       XJ Doherty    stumped        S Dhawan   76 ## 7         CJ McKay     caught         V Kohli   75 ## 8       MG Johnson     caught        V Sehwag   54 ## 9       MG Johnson     caught       G Gambhir   54 ## 10      MG Johnson    run out      RV Uthappa   54 ## 11       MJ Clarke     caught    Yuvraj Singh   27 ## 12      MG Johnson    run out        MS Dhoni   54 ## 13           B Lee    run out        V Sehwag  133 ## 14      NW Bracken     caught       G Gambhir   68 ## 15           B Lee     bowled      KD Karthik  133 ## 16      NW Bracken     caught      RV Uthappa   68 ## 17        JR Hopes     bowled       RG Sharma   10 ## 18       DJ Hussey     caught        MS Dhoni   24 ## 19       AA Noffke     caught         P Kumar   23 ## 20        AC Voges     caught Harbhajan Singh    5 ## 21        AC Voges     caught     S Sreesanth    5 ## 22      NW Bracken     caught       IK Pathan   68 ## 23       DP Nannes     caught         M Vijay   25 ## 24       DP Nannes     caught       G Gambhir   25 ## 25         SW Tait     caught        SK Raina  112 ## 26       DP Nannes     bowled    Yuvraj Singh   25 ## 27       SPD Smith     caught        MS Dhoni   34 ## 28      MG Johnson     caught       YK Pathan   54 ## 29       SR Watson    run out       RA Jadeja  201 ## 30       SR Watson     caught Harbhajan Singh  201
teamBowlersWicketKindOppnAllMatches(sl_wi_matches,"Sri Lanka",'West Indies',plot=TRUE)

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

13. Team bowler’s wicket taken and runs conceded in Twenty20(all matches with opposition)

teamBowlersWicketRunsOppnAllMatches(aus_ind_matches,"India","Australia")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

m <-teamBowlersWicketRunsOppnAllMatches(pak_sa_matches,"Pakistan","South Africa",plot=FALSE) m[1:30,]
## Source: local data frame [30 x 5] ##  ##             bowler overs maidens  runs wickets ##             (fctr) (int)   (int) (dbl)   (dbl) ## 1     Abdul Razzaq     2       0    69       1 ## 2    Mohammad Amir     1       0    63       2 ## 3    Shahid Afridi    11       0   200       6 ## 4      Saeed Ajmal     8       1   202      10 ## 5     Shoaib Malik     3       0    17       0 ## 6         Umar Gul     3       0    93       6 ## 7       Fawad Alam     1       0    15       0 ## 8     Abdur Rehman     1       0    53       2 ## 9  Mohammad Hafeez    10       0   178       9 ## 10   Shoaib Akhtar     1       0    65       3 ## ..             ...   ...     ...   ...     ...

14. Plot of wins vs losses between teams in Twenty20.

setwd("C:/software/cricket-package/york-test/yorkrData/Twenty20/T20-matches") plotWinLossBetweenTeams("India","Sri Lanka")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

plotWinLossBetweenTeams('Pakistan',"South Africa",".")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

plotWinLossBetweenTeams('England',"New Zealand",".")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

plotWinLossBetweenTeams("Australia","West Indies",".")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

plotWinLossBetweenTeams('Bangladesh',"Zimbabwe",".")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

plotWinLossBetweenTeams('Scotland',"Ireland",".")

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

Conclusion

This post included all functions for all Twenty20 matches between any 2 opposing countries. 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

  1. Introducing cricket package yorkr-Part1:Beaten by sheer pace!
  2. Introducing cricket package yorkr: Part 2-Trapped leg before wicket!
  3. Introducing cricket package yorkr:Part 4-In the block hole!
  4. Introducing cricketr! : An R package to analyze performances of cricketers
  5. Cricket analytics with cricketr
  6. Experiments with deblurring using OpenCV
  7. Cloud Computing – Design Considerations
  8. A Cloud medley with IBM Bluemix, Cloudant DB and Node.js
  9. A short video tutorial on my R package cricketr

yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » yorkr pads up for the Twenty20s: Part 2-Head to head confrontation between teams

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
分享按钮