knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of footballdatar is to make it easy to use data from football-data.co.uk in R
.
Currently only available on github (not sure it will ever get to CRAN tbh) and can be installed via:
devtools::install_github("tojyouso/footballdatar")
Currently only downloads data for the EPL but this will be extended to the other European leagues soon. So for the 2017/2018 season use the following:
epl_2017 <- footballdatar::get_football_data(season = 2017) epl_2017
The package also contains a function to clean the data so all the column names are in snake case. Soon, I'll add functionality to set it so any case could be used by using the janitor
package.
epl_2017_clean <- footballdatar::clean_football_data(epl_2017) epl_2017_clean
It also adds some helper columns like season
.
The final function is a helper function to convert the data from match level to team level. This allows for easy calculation of league points for example. It doubles the amount of rows as there will be two rows per match, one for each team and an indicator as to whether that team was home or away.
footballdatar::transform_to_team_level(epl_2017_clean)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.