This file contains hidden or 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 hidden or 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::p_load(tidyverse, polite, scales, ggimage, ggforce, ggtextures, DT, | |
cowplot, rvest, glue, extrafont, ggrepel, magick) | |
loadfonts() | |
theme_womenWorldCup <- function( | |
title.size = 24, | |
subtitle.size = 14, | |
caption.size = 8, | |
axis.text.size = 14, | |
axis.text.x.size = 12, |
This file contains hidden or 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
1. Line-Plot | |
2. Upset Plot (scroll down or Ctrl+F "Upset-Plot") | |
# ---- Line-Plot | |
# Packages | |
```{r} | |
pacman::p_load(dplyr, purrr, tidyr, ggplot2, ggtext, extrafont, | |
scales, ggrepel, forcats, |
This file contains hidden or 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
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE, message = FALSE, warning = FALSE) | |
``` | |
# Packages | |
```{r} | |
pacman::p_load(tidyverse, scales, lubridate, | |
ggrepel, glue, extrafont, |
This file contains hidden or 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
```{r message=FALSE} | |
pacman::p_load(tidyverse, scales, lubridate, ggrepel, | |
glue, extrafont, grid, gridExtra, ggtext) | |
loadfonts(quiet = TRUE) | |
``` | |
```{r} | |
lfc_elo_raw <- read_csv("http://api.clubelo.com/liverpool") |
This file contains hidden or 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 | |
pacman::p_load(tidyverse, understatr, | |
glue, extrafont, magick) | |
loadfonts(quiet = TRUE) | |
## 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 hidden or 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::p_load(tidyverse, polite, scales, ggimage, ggforce, | |
stringr, ggtext, | |
rvest, glue, extrafont, ggrepel) | |
loadfonts(quiet = TRUE) | |
session <- bow("https://www.transfermarkt.com/liverpool-fc/leistungsdaten/verein/31/reldata/GB1%262019/plus/1") | |
print(session) | |
result_name <- scrape(session) %>% | |
html_nodes("#yw1 .bilderrahmen-fixed") %>% |
This file contains hidden or 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 | |
pacman::p_load(tidyverse, polite, scales, ggimage, ggforce, | |
understatr, cowplot, kableExtra, ggbeeswarm, | |
jsonlite, xml2, qdapRegex, stringi, stringr, | |
rvest, glue, extrafont, ggrepel, magick, ggtext) | |
loadfonts(quiet = TRUE) | |
## xPts Table | |
premierleague2019 <- get_league_teams_stats("EPL", 2019) | |
## NON-PENALTY xG |
This file contains hidden or 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
#### | |
# Will keep updating this so if everything isn't there yet please be patient! | |
#### | |
## Packages | |
pacman::p_load(tidyverse, polite, scales, ggimage, ggforce, | |
understatr, cowplot, kableExtra, ggbeeswarm, | |
jsonlite, xml2, qdapRegex, stringi, stringr, | |
rvest, glue, extrafont, ggrepel, magick, ggtext) |
This file contains hidden or 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
## Twitter: @R_by_Ryo | |
## Website: ryo-n7.github.io | |
## Packages | |
pacman::p_load(ggplot2, dplyr, glue, extrafont, ggrepel, magick, ggtext) | |
loadfonts(quiet = TRUE) | |
## load data | |
lewa_shot_contrib <- readRDS(url("https://raw.githubusercontent.com/Ryo-N7/soccer_ggplots/master/data/lewa_shot_contrib.RDS")) |