All Projects → ropenscilabs → Cricketdata

ropenscilabs / Cricketdata

International cricket data for men and women, Tests, ODIs and T20s

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Cricketdata

Cld2
R Wrapper for Google's Compact Language Detector 2
Stars: ✭ 34 (-2.86%)
Mutual labels:  r-package, rstats
Sofa
easy R interface to CouchDB
Stars: ✭ 30 (-14.29%)
Mutual labels:  r-package, rstats
Chr
🔤 Lightweight R package for manipulating [string] characters
Stars: ✭ 18 (-48.57%)
Mutual labels:  r-package, rstats
Ieeer
Search IEEE publications in R
Stars: ✭ 12 (-65.71%)
Mutual labels:  r-package, rstats
Rnaturalearthdata
to hold data used by rnaturalearth
Stars: ✭ 8 (-77.14%)
Mutual labels:  r-package, rstats
Icpsrdata
Reproducible data downloads from the ICPSR data archive
Stars: ✭ 7 (-80%)
Mutual labels:  r-package, rstats
Rtimicropem
😷 R Package for the Analysis of RTI MicroPEM Output Files 😷
Stars: ✭ 9 (-74.29%)
Mutual labels:  r-package, rstats
Vitae
R Markdown Résumés and CVs
Stars: ✭ 627 (+1691.43%)
Mutual labels:  r-package, rstats
Tidymv
Tidy Model Visualisation for Generalised Additive Models
Stars: ✭ 25 (-28.57%)
Mutual labels:  r-package, rstats
Rdhs
API Client and Data Munging for the Demographic and Health Survey Data
Stars: ✭ 22 (-37.14%)
Mutual labels:  r-package, rstats
Originr
Species origin data from the web in R
Stars: ✭ 13 (-62.86%)
Mutual labels:  r-package, rstats
Wellknown
WKT <-> GeoJSON
Stars: ✭ 15 (-57.14%)
Mutual labels:  r-package, rstats
Proj
⛔️ [DEPRECATED] R wrapper for proj4js
Stars: ✭ 5 (-85.71%)
Mutual labels:  r-package, rstats
Skimr
A frictionless, pipeable approach to dealing with summary statistics
Stars: ✭ 889 (+2440%)
Mutual labels:  r-package, rstats
Egretci
A bootstrap method for estimating uncertainty of water quality trends
Stars: ✭ 5 (-85.71%)
Mutual labels:  r-package, rstats
Patentsview
An R client to the PatentsView API
Stars: ✭ 18 (-48.57%)
Mutual labels:  r-package, rstats
Timevis
📅 Create interactive timeline visualizations in R
Stars: ✭ 470 (+1242.86%)
Mutual labels:  r-package, rstats
Shinyjs
💡 Easily improve the user experience of your Shiny apps in seconds
Stars: ✭ 566 (+1517.14%)
Mutual labels:  r-package, rstats
Restez
😴 📂 Create and Query a Local Copy of GenBank in R
Stars: ✭ 22 (-37.14%)
Mutual labels:  r-package, rstats
Spenv
Combine environmental and spatial data
Stars: ✭ 8 (-77.14%)
Mutual labels:  r-package, rstats

cricketdata

Functions for Downloading Cricket Data from ESPNCricinfo

Data on all international cricket matches is provided by ESPNCricinfo. This package provides some scraper functions to download the data into tibbles ready for analysis.

Please respect the ESPNCricinfo terms of use.

Installation

You can install cricketdata from github with:

# install.packages("devtools")
devtools::install_github("ropenscilabs/cricketdata")

Bowling Data

# Fetch all Women's T20 data
wt20 <- fetch_cricinfo("T20", "Women", "Bowling")
wt20 %>% head() %>% knitr::kable()
Player Country Start End Matches Innings Overs Maidens Runs Wickets Average Economy StrikeRate BestBowlingInnings FourWickets FiveWickets
A Mohammed West Indies 2008 2018 99 95 336.3 6 1854 113 16.40708 5.509658 17.86726 5/10 4 3
EA Perry Australia 2008 2018 102 98 324.5 6 1919 100 19.19000 5.907645 19.49000 4/12 3 0
D Hazell England 2009 2018 85 85 317.3 6 1764 85 20.75294 5.555905 22.41176 4/12 1 0
Nida Dar Pakistan 2010 2018 88 83 273.1 7 1374 82 16.75610 5.029896 19.98780 5/21 1 1
SR Taylor West Indies 2008 2018 93 73 247.3 4 1348 82 16.43902 5.446465 18.10976 4/12 1 0
Sana Mir Pakistan 2009 2018 97 96 342.2 8 1850 81 22.83951 5.404090 25.35802 4/13 4 0

wt20 %>% 
  filter(
    Wickets > 20,
    !is.na(Country)
  ) %>%
  ggplot(aes(y = StrikeRate, x = Country)) +
    geom_boxplot() +
    geom_point(alpha=0.3, col="blue") +
    ggtitle("Women T20: Strike Rates") +
    ylab("Balls per wicket")

Batting Data

# Fetch all Australian Men's ODI data by innings
menODI <- fetch_cricinfo("ODI", "Men", "Batting", type="innings", country="Australia")
menODI %>% head() %>% knitr::kable()
Date Player Runs NotOut Minutes BallsFaced Fours Sixes StrikeRate Innings Participation Opposition Ground
2011-04-11 SR Watson 185 TRUE 113 96 15 15 192.7083 2 B Bangladesh Dhaka
2007-02-20 ML Hayden 181 TRUE 227 166 11 10 109.0361 1 B New Zealand Hamilton
2017-01-26 DA Warner 179 FALSE 186 128 19 5 139.8438 1 B Pakistan Adelaide
2015-03-04 DA Warner 178 FALSE 164 133 19 5 133.8346 1 B Afghanistan Perth
2001-02-09 ME Waugh 173 FALSE 199 148 16 3 116.8919 1 B West Indies Melbourne
2016-10-12 DA Warner 173 FALSE 218 136 24 0 127.2059 2 B South Africa Cape Town

menODI %>% 
  ggplot(aes(y = Runs, x = Date)) +
    geom_point(alpha=0.2, col='red') +
    geom_smooth() +
    ggtitle("Australia Men ODI: Runs per Innings")
#> `geom_smooth()` using method = 'gam' and formula 'y ~ s(x, bs = "cs")'
#> Warning: Removed 2496 rows containing non-finite values (stat_smooth).
#> Warning: Removed 2496 rows containing missing values (geom_point).

Fielding Data

Indfielding <- fetch_cricinfo("Test", "Men", "Fielding", country="India")
Indfielding %>% head() %>% knitr::kable()
Player Start End Matches Innings Dismissals Caught CaughtFielder CaughtBehind Stumped MaxDismissalsInnings
MS Dhoni 2005 2014 90 166 294 256 0 256 38 6
R Dravid 1996 2012 163 299 209 209 209 0 0 3
SMH Kirmani 1976 1986 88 151 198 160 0 160 38 6
VVS Laxman 1996 2012 134 248 135 135 135 0 0 4
KS More 1986 1993 49 90 130 110 0 110 20 5
SR Tendulkar 1989 2013 200 366 115 115 115 0 0 3

Indfielding %>%
  mutate(wktkeeper = (CaughtBehind > 0) | (Stumped > 0)) %>%
  ggplot(aes(x=Matches, y=Dismissals, col=wktkeeper)) +
    geom_point() +
    ggtitle("Indian Men Test Fielding")

Individual player data

MegLanning <- fetch_player_data(329336, "ODI") %>%
  mutate(NotOut = (Dismissal=="not out"))
MLave <- summarise(MegLanning,
    Innings = sum(!is.na(Runs)),
    Average = sum(Runs, na.rm=TRUE) / (Innings - sum(NotOut))
  ) %>%
  pull(Average)
names(MLave) <- paste("Average =", round(MLave,2))

ggplot(MegLanning) + 
  geom_point(aes(x = Start_Date, y = Runs, col = NotOut)) +
  ggtitle("Meg Lanning ODI Scores") +
  geom_hline(aes(yintercept=MLave)) +
  scale_y_continuous(sec.axis = sec_axis(~ ., breaks=MLave))

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].