Skip to content

Instantly share code, notes, and snippets.

View Ryo-N7's full-sized avatar

Ryo Nakagawara Ryo-N7

View GitHub Profile
@Ryo-N7
Ryo-N7 / EPL_xGD_plot.r
Last active November 14, 2019 06:20
EPL Expected Goal Difference Plot (up to Nov. 10, 2019 // Matchday 12)
# 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
@Ryo-N7
Ryo-N7 / kloppo_v2.RMD
Created October 9, 2019 14:44
Klopp's Managerial History v2
```{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")
@Ryo-N7
Ryo-N7 / elo_europe_cups_plot.RMD
Last active September 1, 2019 14:47
Champions League + Europa League Elo ratings per team/group
```{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,
@Ryo-N7
Ryo-N7 / roman_emperors.RMD
Last active August 15, 2019 10:45
TidyTuesday (August 14): Roman Emperors
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,
@Ryo-N7
Ryo-N7 / wwc_goaldist.r
Created July 8, 2019 18:40
Women's World Cup #tidytuesday
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,
@Ryo-N7
Ryo-N7 / player_minutes_LFC_10_11.r
Last active December 26, 2022 13:19
Player minutes chart Liverpool FC, 2010-2011 (Hodgson vs. Dalglish)
## 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)
@Ryo-N7
Ryo-N7 / GanadoresDeCopaAmerica.r
Last active June 14, 2019 17:02
Most successful teams of the Copa America!
## packages
library(dplyr)
library(tidyr)
library(purrr)
library(stringr)
library(rvest)
library(polite) ## github only
library(ggplot2)
library(scales)
library(glue)
@Ryo-N7
Ryo-N7 / goleadoresdecopamerica.r
Last active June 7, 2019 12:51
Top scorers of the Copa America
# pkgs
library(dplyr)
library(tidyr)
library(purrr)
library(stringr)
library(rvest)
library(polite)
library(ggplot2)
library(scales)
library(cowplot)
@Ryo-N7
Ryo-N7 / laliga_goal_contribution_matrix.r
Last active May 30, 2019 10:45
Goal contribution matrix for La Liga (2018-2019 Season)
## 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
@Ryo-N7
Ryo-N7 / epl_goal_contribution_matrix_18-19.r
Last active April 1, 2021 14:19
Goal contribution matrix for Premier League 2018-2019
# 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