This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(soccermatics) | |
library(StatsBombR) | |
library(tidyverse) | |
library(ggsoccer) | |
matchesdf <- FreeMatches(FreeCompetitions()) %>% filter(competition.competition_id == 11, season.season_id == 90) | |
barhue <- matchesdf %>% filter(match_id == 3773369) | |
barhue_df <- get.matchFree(barhue) %>% allclean() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## pacman pkg to load/install libraries from cran | |
## polite is a github only pkg though. | |
pacman::p_load(tidyverse, polite, scales, ggimage, ggforce, | |
rvest, glue, extrafont, ggrepel, magick) | |
loadfonts() | |
## Squad details for 2010-2011 season | |
url <- "https://www.transfermarkt.com/liverpool-fc/leistungsdaten/verein/31/reldata/GB1%262010/plus/1" | |
session <- bow(url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Packages | |
```{r} | |
library(rvest) | |
library(polite) # devtools::install_github("dmi3kno/polite") | |
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
library(scales) | |
library(purrr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pkgs | |
pacman::p_load(tidyverse, polite, scales, ggimage, ggforce, | |
rvest, glue, extrafont, ggrepel, magick) | |
loadfonts() | |
## add_logo function from Thomas Mock | |
add_logo <- function(plot_path, logo_path, logo_position, logo_scale = 10){ | |
# Requires magick R Package https://github.com/ropensci/magick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# saw these types of plots for different leagues on r/soccer | |
# (originally by Twitter: @fussbALEXperte) | |
# so thought I'd make my own version using R! | |
library(rvest) | |
library(polite) | |
library(dplyr) | |
library(tidyr) | |
library(purrr) | |
library(ggplot2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
library(cranlogs) | |
library(ggtextures) # devtools::install_github("clauswilke/ggtextures") | |
library(extrafont) | |
loadfonts() | |
# top 10 package downloads from 9/29 to 10/28 from 'cranlogs' package | |
top_10_october <- cran_top_downloads(when = "last-month", count = 10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pkgs | |
```{r, message=FALSE, warning=FALSE} | |
pacman::p_load(dplyr, tidyr, purrr, scales, | |
ggplot2, ggtext, tibble, stringr, | |
glue, extrafont, ggbump, forcats) | |
loadfonts() | |
``` | |
## raw data (scraped from transfermarkt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pkgs | |
```{r, message=FALSE, warning=FALSE} | |
pacman::p_load(tidyverse, polite, scales, ggimage, | |
ggforce, ggtext, | |
rvest, glue, extrafont, ggrepel, magick) | |
loadfonts() | |
``` | |
## add_logo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pkgs | |
```{r, message=FALSE, warning=FALSE} | |
pacman::p_load(tidyverse, polite, scales, ggimage, | |
ggforce, ggtext, | |
rvest, glue, extrafont, ggrepel, magick) | |
loadfonts() | |
``` | |
## add_logo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pkgs | |
```{r, message=FALSE, warning=FALSE} | |
pacman::p_load(tidyverse, scales, ggforce, ggtext, | |
rvest, glue, extrafont, ggrepel, magick) | |
loadfonts() | |
``` | |
## add_logo |
NewerOlder