-
Notifications
You must be signed in to change notification settings - Fork 62
/
README.Rmd
148 lines (91 loc) · 6.43 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
options(tibble.print_min = 5, tibble.print_max = 5)
```
# worldfootballR <img src="man/figures/logo.png" align="right" width="181" height="201"/>
<!-- badges: start -->
[![Version-Number](https://img.shields.io/github/r-package/v/JaseZiv/worldfootballR?label=worldfootballR (Dev))](https://github.com/JaseZiv/worldfootballR/)
[![R build status](https://github.com/JaseZiv/worldfootballR/workflows/R-CMD-check/badge.svg)](https://github.com/JaseZiv/worldfootballR/actions)
[![codecov](https://codecov.io/gh/JaseZiv/worldfootballR/branch/main/graph/badge.svg?token=WGLU5J34VL)](https://app.codecov.io/gh/JaseZiv/worldfootballR)
[![CRAN status](https://www.r-pkg.org/badges/version-last-release/worldfootballR?style=for-the-badge)](https://CRAN.R-project.org/package=worldfootballR)
[![CRAN downloads](http://cranlogs.r-pkg.org/badges/grand-total/worldfootballR)](https://CRAN.R-project.org/package=worldfootballR)
[![Downloads](https://cranlogs.r-pkg.org/badges/worldfootballR)](https://cran.r-project.org/package=worldfootballR)
<!-- badges: end -->
## Overview
This package is designed to allow users to extract various world football results and player statistics from the following popular football (soccer) data sites:
* FBref
* [Transfermarkt](https://www.transfermarkt.com/)
* [Understat](https://understat.com/)
## Installation
As at 2024-06-29, we are no longer including instructions to install from CRAN. The version pushed to CRAN is very much out of date, and with very regular updates to this library, we advise installing from GitHub only.
You can install the released version of [**```worldfootballR```**](https://github.com/JaseZiv/worldfootballR/) from [GitHub](https://github.com/JaseZiv/worldfootballR) with:
```{r gh-installation, eval=FALSE}
# install.packages("devtools")
devtools::install_github("JaseZiv/worldfootballR")
```
```{r load_libs, warning=FALSE, message=FALSE}
library(worldfootballR)
```
***
## Usage
Package vignettes have been built to help you get started with the package.
* For functions to extract data from FBref, see [here](https://jaseziv.github.io/worldfootballR/articles/extract-fbref-data.html)
* For functions to extract data from Transfermarkt, see [here](https://jaseziv.github.io/worldfootballR/articles/extract-transfermarkt-data.html)
* For functions to extract data from Understat, see [here](https://jaseziv.github.io/worldfootballR/articles/extract-understat-data.html)
* For functions to extract data for international matches from FBref, see [here](https://jaseziv.github.io/worldfootballR/articles/fbref-data-internationals.html)
* For functions to load pre-scraped data, see [here](https://jaseziv.github.io/worldfootballR/articles/load-scraped-data.html)
### Loading Data
<img src="https://github.com/JaseZiv/worldfootballR_data/blob/master/man/figures/logo.png" align="center" width="181" height="201"/>
Since the release of `v0.5.3`, the library now supports very rapid loading of pre-collected data through the use of `load_` functions.
The data available for loading is stored in the `worldfootballR_data` repository. The repo can be found [here](https://github.com/JaseZiv/worldfootballR_data).
Head to the vignette [here](https://jaseziv.github.io/worldfootballR/articles/load-scraped-data.html) to see examples of which data is available for rapid loading.
***
## News
To stay up-to-date with the latest changes, see the package [change log](https://jaseziv.github.io/worldfootballR/news/index.html)
Note that fotmob data is no longer provided since the release of `v0.6.4` due to a change in their [terms of service](https://www.fotmob.com/tos.txt).
***
## Leagues and Seasons
### FBref
For FBref.com data (match and season data), a list of leagues and seasons included in the package can be found in the `worldfootballR_data` repository and can be found [here](https://github.com/JaseZiv/worldfootballR_data/blob/master/raw-data/all_leages_and_cups/all_competitions.csv)
### Transfermarkt
For transfermarkt.com data (valuations and transfers), a list of leagues and seasons included in the package can be found in the `worldfootballR_data` repository and can be found [here](https://github.com/JaseZiv/worldfootballR_data/blob/master/raw-data/transfermarkt_leagues/main_comp_seasons.csv)
### Understat
The following leagues are currently supported by Understat (these values can be passed in to the `league` arguments of most `understat_` functions):
* "EPL"
* "La liga"
* "Bundesliga"
* "Serie A"
* "Ligue 1"
* "RFPL"
***
## Attribute the Source
When using the functions in the package, **please ensure you attribute the source of the data based on the function you use**.
Data providers are listed below:
* [FBref](https://fbref.com/en/) partnered with StatsPerform Opta
* [Transfermarkt](https://www.transfermarkt.com/)
* [Understat](https://understat.com/)
### Acknowledgements
Special mention goes out to [Ewan Henderson's](https://github.com/ewenme) awesome [`understatr`](https://github.com/ewenme/understatr) library for the inspiration and internal code for the `understat_` functions contained in this package.
***
## Contributing
### Issues and Improvements
Before creating an issue, **please ensure you have the latest version installed from GitHub**. Check the changelog for more details on changes that have been made to the library.
When creating an issue, please include:
* Reproducible examples
* A brief description of what the expected results are
* If applicable, the fbref.com, transfermarkt.com or understat.com page the observed behaviour is occurring on
* For improvement suggestions, what features are being requested and their purpose
Feel free to get in touch via email or [Bluesky](https://bsky.app/profile/jaseziv.bsky.social) if you aren't able to create an issue.
### Show your support
Follow me on Bluesky [jaseziv](https://bsky.app/profile/jaseziv.bsky.social) for updates
If this package helps you, all I ask is that you star this repo. If you did want to show your support and contribute to server time and data storage costs, feel free to send a small donation through the link below.
<a href="https://www.buymeacoffee.com/jaseziv83A" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Coffee (Server Time)" height="41" width="174"></a>