library(tidyverse)
library(scales)
library(cricketdata)Top T20 Cricket International Batters
Getting the Data
This is how I scraped the data, and then saved it. It can take repeated attempts and considerable time to finish this process.
crick_batters <- fetch_cricinfo("t20", "men", "batting", "career", country = NULL)
all_batters <- saveRDS(crick_batters, "all_batters")The saved data can be used to extract the data on the ten batters who have scored the most runs in their international T20 careers.
t20_batters <- readRDS("all_batters")
top_batters <- t20_batters |> dplyr::slice_max(order_by = Runs, n = 10)Top Ten Batters: Career Totals
Figure 1 shows the simple story of who scored the most runs. The columns are color coded by the countries of the respective batters.
ggplot(top_batters, aes(x = fct_reorder(Player, Runs), y = Runs)) +
geom_col(aes(fill = Country)) +
scale_x_discrete(labels = label_wrap(2)) +
labs(title = "Top Ten T20 International Batters", x = "Batters", y = "Runs Scored", caption = "Source: ESPNcricinfo")Top Ten Batters: Career Progress
Figure 2 shows runs scored in proportion to the total number of balls faced. This gives us an idea of progress each has made when compared to the length of their career.
ggplot(top_batters, aes(x = BallsFaced, y = Runs, label = Player)) +
geom_point() + geom_text(hjust=0.25, vjust=-0.5) +
xlim(1500, 3500) +
# X axis has been extended to make it easier for prevent the player names from being "cut off"
labs(title = "Top Batters: Career Progress", x = "Runs Scored", y = "Balls Faced", caption = "Source: ESPNcricinfo")Top Ten Batters: Strike Rate
Figure 3 shows each batter’s strike rate in proportion to total balls faced.
The strike rate is the average number of runs scored per 100 balls faced. The higher the strike rate, the more effective a batter is at scoring quickly.
In this chart, the bigger the dot for each player, the higher the strike rate. This is a novel way to presnt this data, but I think this makes it hard to follow what is going on here.
ggplot(top_batters, aes(x = BallsFaced, y = Runs, label = Player)) +
geom_point(aes(size = StrikeRate)) + geom_text(hjust=0.2, vjust=-1.25) +
xlim(1500, 3500) +
ylim(2500, 4500) +
# X axis has been extended to make it easier for prevent the player names from being "cut off"
labs(title = "Top Batters: Strike Rates", x = "Runs Scored", y = "Strike Rates", caption = "Source: ESPNcricinfo")Figure 4 shows the strike rates more effectively. It is now easy to see that Maxwell is progressing quite rapidly, and is likely to someday outperform batters who are currently further along in their careers. The top three batters, Sharma, Azam, and Kohli have amassed similar totals. But Sharma has the best strike rate.
ggplot(top_batters, aes(x = Runs, y = StrikeRate, label = Player)) +
geom_point() + geom_text(hjust=0.25, vjust=-0.5) +
xlim(2500, 4500) +
# X axis has been extended to make it easier for prevent the player names from being "cut off"
labs(title = "Top Batters: Strike Rate", x = "Runs Scored", y = "Strike Rate", caption = "Source: ESPNcricinfo")