In this notebook I use my R package yorkr to perform analysis of
The data for these 2 analyses are available on Github. To know more about my R package 'yorkr' do take a look at my blog Giga thoughts. My package yorkr uses data from Cricsheet and can handle ODI, T20 and IPL matches. The data in Cricsheet are in yaml format. I have already converted the data of the individual matches to .RData and have uploaded it to Github. You can download or use this data from Github which is available at yorkrData. The details on how to use this data are also available in my blog posts.
install.packages("yorkr") library(yorkr) library(rpart) library(dplyr)
Installing package into '/gpfs/global_fs01/sym_shared/YPProdSpark/user/sc50-a979762c5b05ec-d2b8f26cd8fd/R/libs' (as 'lib' is unspecified) Attaching package: 'dplyr' The following objects are masked from 'package:SparkR': arrange, between, collect, contains, count, cume_dist, dense_rank, desc, distinct, explain, filter, first, group_by, intersect, lag, last, lead, mutate, n, n_distinct, ntile, percent_rank, rename, row_number, sample_frac, select, sql, summarize The following objects are masked from 'package:stats': filter, lag The following objects are masked from 'package:base': intersect, setdiff, setequal, union
Disclaimer: This article represents the author’s viewpoint only and doesn’t necessarily represent IBM’s positions, strategies or opinions
load(url("https://github.com/tvganesh/yorkrData/raw/master/ODI/ODI-matches/Australia-India-2012-02-12.RData")) aus_ind <- overs
# Display the batting scorecard of Australia teamBattingScorecardMatch(aus_ind,'Australia')
# Display the batting scorecard of India teamBattingScorecardMatch(aus_ind,'India')
# Plot the batting partenerships of India teamBatsmenPartnershipMatch(aus_ind,"India","Australia")
# Plot the performance of Australian batsmen against Indian bowlers teamBatsmenVsBowlersMatch(aus_ind,'Australia',"India", plot=TRUE)
# Display the bowling scorecard of India teamBowlingScorecardMatch(aus_ind,'India')
|2||R Vinay Kumar||10||1||58||5|
# Display the Wicket kind vs Runs conceded of Australia teamBowlingWicketKindMatch(aus_ind,"Australia","India")
# Plot the runs conceded of India bowlers vs Australia teamBowlersVsBatsmenMatch(aus_ind,"India","Australia")
# Plot the worm chart of the match matchWormGraph(aus_ind,'Australia',"India")
In this part of the notebook I analyze performance of Virat Kohli of Royal Challengers Bangalore(RCB). For this I use the data of all matches of RCB. As I mentioned above the data of all the IPL teams are available at yorkrData. You can this data for other players of RCB. In yorkrdata data is available for other IPL teams like CSK, MI, DD etc. You can import this notebook and just change the URL and a few other minor changes to analyze the performance of the player of that team. For e.g. M S Dhoni of Chennai Super Kings, or Rohit Sharma of Mumbai Indians etc.
Note:: This posts uses data for IPL matches. However yorkrData also has data for ODI and T20 matches. You can do similar analysis of other batsmen or bowlers in ODI ot T20 matches. For details on how to use the R package 'yorkr' please see my blog Giga thoughts and check out the posts on yorkr for IDI, T20 and IPL matches. All posts can be seen at Index of Posts
# Load the RCB Batting details data from yorkrData load(url("https://github.com/tvganesh/yorkrData/raw/master/battingBowlingDetails/Royal%20Challengers%20Bangalore-BattingDetails.RData")) save(battingDetails,file="Royal Challengers Bangalore-BattingDetails.RData") # Get the current directory d= getwd() # Call getBastmanDetails() and set the path where the .RData file is available kohli <- getBatsmanDetails(team="Royal Challengers Bangalore",name="V Kohli",dir=d) dim(kohli)
 "/gpfs/global_fs01/sym_shared/YPProdSpark/user/sc50-a979762c5b05ec-d2b8f26cd8fd/notebook/work/Royal Challengers Bangalore-BattingDetails.RData"
# Plot the runs scored vs deliveries faced by Virat Kohli at IPL batsmanRunsVsDeliveries(kohli,"V Kohli")