Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
JaseZiv committed Feb 10, 2021
1 parent 0ab0a60 commit 4021471
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 9 deletions.
32 changes: 32 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,38 @@ big_5_2020_possessions <- get_season_team_stats(country = c("ENG", "ESP", "ITA",
gender = "M", season_end_year = 2020, stat_type = "possession")
```

***

### Transfer and Market Valuations

The following functions allow the user to extract transfer data for players, and also market valuations by league season. The data for these functions comes from transfermarkt.com

#### Market Values

The following function allows the user to extract player market values from transfermarkt.com.

To get a list of the countries available, see the following link https://github.com/JaseZiv/worldfootballR_data/blob/master/raw-data/transfermarkt_leagues/main_comp_seasons.csv

```{r get_market_vals}
prem_vals <- get_player_market_values(country_name = "England", start_year = 2020)
glimpse(prem_vals)
```


#### Transfer history

The following function allows the user to get transfer history for a player or group of players, only requiring the player urls from transfermarkt.com:

```{r}
urls <- c("https://www.transfermarkt.com/cristiano-ronaldo/profil/spieler/8198",
"https://www.transfermarkt.com/alisson/profil/spieler/105470")
transfers <- player_transfer_history(urls)
glimpse(transfers)
```


***

## Contributing
Expand Down
68 changes: 64 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ glimpse(serieA_2020)
#> $ Date <date> 2019-08-24, 2019-08-24, 2019-08-25, 2019-08-25, 201…
#> $ Time <chr> "18:00", "20:45", "18:00", "20:45", "20:45", "20:45"…
#> $ Home <chr> "Parma", "Fiorentina", "Udinese", "Torino", "SPAL", …
#> $ HomeGoals <dbl> 0, 3, 1, 2, 2, 3, 1, 0, 0, 4, 1, 1, 4, 1, 2, 1, 0, 1…
#> $ Home_xG <dbl> 0.4, 1.7, 1.0, 1.2, 1.6, 1.9, 0.2, 1.0, 0.8, 1.7, 2.…
#> $ HomeGoals <dbl> 0, 3, 1, 2, 2, 3, 0, 1, 0, 4, 1, 1, 4, 1, 2, 1, 0, 1…
#> $ Home_xG <dbl> 0.4, 1.7, 1.0, 1.2, 1.6, 1.9, 1.0, 0.2, 0.8, 1.7, 2.…
#> $ Away <chr> "Juventus", "Napoli", "Milan", "Sassuolo", "Atalanta…
#> $ AwayGoals <dbl> 1, 4, 0, 1, 3, 3, 1, 1, 3, 0, 0, 0, 3, 1, 3, 2, 1, 3…
#> $ Away_xG <dbl> 1.3, 2.0, 0.5, 1.5, 1.7, 1.3, 1.6, 1.5, 2.3, 0.7, 0.…
#> $ Attendance <dbl> 20073, 33614, 24584, 16536, 11706, 38779, 16324, 160
#> $ Away_xG <dbl> 1.3, 2.0, 0.5, 1.5, 1.7, 1.3, 1.5, 1.6, 2.3, 0.7, 0.…
#> $ Attendance <dbl> 20073, 33614, 24584, 16536, 11706, 38779, 16099, 163
#> $ Venue <chr> "Stadio Ennio Tardini", "Stadio Artemio Franchi", "D…
#> $ Referee <chr> "Fabio Maresca", "Davide Massa", "Fabrizio Pasqua", …
#> $ Notes <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
Expand Down Expand Up @@ -392,6 +392,66 @@ big_5_2020_possessions <- get_season_team_stats(country = c("ENG", "ESP", "ITA",

-----

### Transfer and Market Valuations

The following functions allow the user to extract transfer data for
players, and also market valuations by league season. The data for these
functions comes from transfermarkt.com

#### Market Values

The following function allows the user to extract player market values
from transfermarkt.com.

To get a list of the countries available, see the following link
<https://github.com/JaseZiv/worldfootballR_data/blob/master/raw-data/transfermarkt_leagues/main_comp_seasons.csv>

``` r
prem_vals <- get_player_market_values(country_name = "England", start_year = 2020)
glimpse(prem_vals)
#> Rows: 512
#> Columns: 11
#> $ comp_name <chr> "Premier League", "Premier League", "Premier…
#> $ region <chr> "Europe", "Europe", "Europe", "Europe", "Eur…
#> $ country <chr> "England", "England", "England", "England", …
#> $ season_start_year <int> 2020, 2020, 2020, 2020, 2020, 2020, 2020, 20…
#> $ squad <chr> "Liverpool FC", "Liverpool FC", "Liverpool F…
#> $ player_num <chr> "1", "13", "62", "4", "12", "32", "19", "46"…
#> $ player_name <chr> "Alisson", "Adrián", "Caoimhin Kelleher", "V…
#> $ player_dob <date> 1992-10-02, 1987-01-03, 1998-11-23, 1991-07…
#> $ player_age <dbl> 28, 34, 22, 29, 23, 29, 20, 20, 25, 23, 26, …
#> $ player_market_value_euro <dbl> 8.0e+07, 2.0e+06, 2.0e+06, 8.0e+07, 4.0e+07,…
#> $ player_url <chr> "https://www.transfermarkt.com/alisson/profi…
```

#### Transfer history

The following function allows the user to get transfer history for a
player or group of players, only requiring the player urls from
transfermarkt.com:

``` r
urls <- c("https://www.transfermarkt.com/cristiano-ronaldo/profil/spieler/8198",
"https://www.transfermarkt.com/alisson/profil/spieler/105470")

transfers <- player_transfer_history(urls)

glimpse(transfers)
#> Rows: 11
#> Columns: 9
#> $ player_name <chr> "Cristiano Ronaldo", "Cristiano Ronaldo", "Cristiano R…
#> $ season <chr> "18/19", "09/10", "03/04", "02/03", "00/01", "98/99", …
#> $ transfer_date <date> 2018-07-10, 2009-07-01, 2003-08-12, 2002-07-01, 2000-…
#> $ country_from <chr> "Spain", "England", "Portugal", "Portugal", "Portugal"…
#> $ team_from <chr> "Real Madrid", "Man Utd", "Sporting CP", "Sporting U19…
#> $ country_to <chr> "Italy", "Spain", "England", "Portugal", "Portugal", "…
#> $ team_to <chr> "Juventus", "Real Madrid", "Man Utd", "Sporting CP", "…
#> $ market_value <dbl> 1.0e+08, 6.0e+07, NA, NA, NA, NA, NA, 6.0e+07, 7.0e+06…
#> $ transfer_value <dbl> 1.17e+08, 9.40e+07, 1.90e+07, NA, NA, NA, NA, 6.25e+07…
```

-----

## Contributing

### Issues and Feature Requests
Expand Down
59 changes: 55 additions & 4 deletions docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pandoc: 2.7.3
pkgdown: 1.6.1
pkgdown_sha: ~
articles: {}
last_built: 2021-02-10T10:29Z
last_built: 2021-02-10T10:46Z
urls:
reference: https://jaseziv.github.io/worldfootballR//reference
article: https://jaseziv.github.io/worldfootballR//articles
Expand Down

0 comments on commit 4021471

Please sign in to comment.