[This article was first published on Analysis of AFL, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Recently I was on twitter and saw this tweet here. Being a Connor Blakely fan I thought to myself I wonder if those are actualy good odds and if I could visualise this.
So what is the theme of the thread, well it seems as though Chris and SgtButane think that Connor is likely to get more than 110 fantasy points and that he has a better fantasy record at home vs away.
library(tidyverse) ## -- Attaching packages -------------------------------- tidyverse 1.2.1 -- ## v ggplot2 2.2.1 v purrr 0.2.5 ## v tibble 1.4.2 v dplyr 0.7.5 ## v tidyr 0.8.1 v stringr 1.3.0 ## v readr 1.1.1 v forcats 0.3.0 ## -- Conflicts ----------------------------------- tidyverse_conflicts() -- ## x dplyr::filter() masks stats::filter() ## x dplyr::lag() masks stats::lag() library(fitzRoy) df<-fitzRoy::get_footywire_stats(9514:9576) ## Getting data from footywire.com ## Finished getting data df1<-fitzRoy::player_stats df2<-rbind(df1, df) df2%>% select(Player, AF, Date, Status)%>% filter(Player %in% c("Connor Blakely"))%>% ggplot(aes(x=Date, y=AF, colour=Status))+ geom_point()+ geom_segment(aes(x=Date, xend=Date,y=0, yend=AF ))+ geom_hline(yintercept =109) +ggtitle("Conor Blakely AF scores")+ ylab("AF Score") +ylim(0,150) +geom_text(aes(label=AF),vjust=-1)
Does that look like a good bet? You be the judge!
Update
Received an email asking how would I compare two players?
Let me compare Connor Blakely to Jack Steele
library(tidyverse) library(fitzRoy) df<-fitzRoy::get_footywire_stats(9514:9576) ## Getting data from footywire.com ## Finished getting data df1<-fitzRoy::player_stats df2<-rbind(df1, df) df2%>% select(Player, AF, Date, Status)%>% filter(Player %in% c("Connor Blakely", "Jack Steele"))%>% ggplot(aes(x=Date, y=AF, colour=Status))+ geom_point()+ geom_segment(aes(x=Date, xend=Date,y=0, yend=AF ))+ geom_hline(yintercept =109) +ggtitle("Compare the pair")+ ylab("AF Score") +ylim(0,150) +geom_text(aes(label=AF),vjust=-1) +facet_wrap(~Player)
All you have to do is add the Player to the filter and the facet_wrap(~Player)
line and you are good to go.
To leave a comment for the author, please follow the link and comment on their blog: Analysis of AFL.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.