Fetch individual player data from all matches played. The function will scrape the data from ESPNCricinfo and return a tibble with one line per innings for all games a player has played. To identify a player, use their Cricinfo player ID. The simplest way to find this is to look up their Cricinfo Profile page. The number at the end of the URL is the ID. For example, Meg Lanning's profile page is http://www.espncricinfo.com/australia/content/player/329336.html, so her ID is 329336.

  matchtype = c("test", "odi", "t20"),
  activity = c("batting", "bowling", "fielding")



The player ID as given in the Cricinfo profile. Integer or character.


Which type of cricket matches do you want? Tests, ODIs or T20s? Not case-sensitive.


Which type of activities do you want? Batting, Bowling or Fielding? Not case-sensitive.


A tibble containing data on the selected player, with one row for every innings of every match in which they have played.


Rob J Hyndman and Sayani Gupta


if (FALSE) { # Download data on some players EllysePerry <- fetch_player_data(275487, "T20", "batting") RahulDravid <- fetch_player_data(28114, "ODI", "fielding") LasithMalinga <- fetch_player_data(49758, "Test", "bowling") # Create a plot for Ellyse Perry's T20 scores library(dplyr) library(ggplot2) EllysePerry %>% filter(!is.na(Runs)) %>% ggplot(aes(x=Start_Date, y=Runs, col = Dismissal, na.rm = TRUE)) + geom_point() + ggtitle("Ellyse Perry's T20 Scores") }