The table below can be re-sorted by clicking on the column headers.
| Premier League Fixtures 2023-2024. | ||||||||||||||||||||
| Teams in pink are away (A). | ||||||||||||||||||||
| Week | ARS | AVL | BHA | BOU | BRE | BUR | CHE | CRY | EVE | FUL | LIV | LUT | MCI | MUN | NEW | NFO | SHU | TOT | WHU | WOL |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | NFO (A) | NEW | LUT (A) | WHU (A) | TOT (A) | MCI (A) | LIV (A) | SHU | FUL (A) | EVE | CHE | BHA | BUR | WOL (A) | AVL (A) | ARS | CRY (A) | BRE | BOU | MUN |
| 2 | CRY | EVE (A) | WOL | LIV | FUL | WHU | ARS (A) | AVL | BRE (A) | BOU (A) | NEW (A) | TOT | MCI | SHU (A) | NFO | MUN (A) | CHE (A) | BHA (A) | ||
| 3 | FUL (A) | BUR | WHU (A) | TOT (A) | CRY (A) | AVL (A) | LUT (A) | BRE | WOL (A) | ARS | NEW | CHE | SHU | NFO (A) | LIV (A) | MUN | MCI (A) | BOU | BHA | EVE |
| 4 | MUN (A) | LIV | NEW (A) | BRE | BOU (A) | TOT (A) | NFO (A) | WOL (A) | SHU | MCI | AVL (A) | WHU (A) | FUL (A) | ARS | BHA | CHE | EVE (A) | BUR | LUT | CRY |
| 5 | EVE | CRY (A) | MUN | CHE (A) | NEW | NFO | BOU | AVL | ARS (A) | LUT (A) | WOL | FUL | WHU | BHA (A) | BRE (A) | BUR (A) | TOT | SHU (A) | MCI (A) | LIV (A) |
| 6 | TOT (A) | CHE | BOU (A) | BHA | EVE (A) | MUN (A) | AVL (A) | FUL (A) | BRE | CRY | WHU (A) | WOL (A) | NFO (A) | BUR | SHU | MCI | NEW (A) | ARS | LIV | LUT |
| 7 | BOU | BHA (A) | AVL | ARS (A) | NFO | NEW, LUT | FUL | MUN | LUT (A) | CHE (A) | TOT | EVE, BUR (A) | WOL | CRY (A) | BUR (A) | BRE (A) | WHU | LIV (A) | SHU (A) | MCI (A) |
| 8 | MCI (A) | WOL | LIV (A) | EVE | MUN | CHE (A) | BUR | NFO (A) | BOU (A) | SHU (A) | BHA | TOT (A) | ARS | BRE (A) | WHU | CRY | FUL | LUT | NEW (A) | AVL (A) |
| 9 | CHE | WHU (A) | MCI | WOL (A) | BUR (A) | BRE | ARS (A) | NEW | LIV | TOT | EVE (A) | NFO | BHA (A) | SHU | CRY (A) | LUT (A) | MUN (A) | FUL (A) | AVL | BOU |
| 10 | SHU (A) | LUT (A) | FUL (A) | BUR (A) | CHE | BOU | BRE (A) | TOT (A) | WHU | BHA | NFO (A) | AVL | MUN | MCI (A) | WOL | LIV | ARS | CRY | EVE (A) | NEW (A) |
| 11 | NEW | NFO | EVE | MCI | WHU (A) | CRY (A) | TOT | BUR | BHA (A) | MUN (A) | LUT | LIV (A) | BOU (A) | FUL | ARS (A) | AVL (A) | WOL (A) | CHE (A) | BRE | SHU |
| 12 | BUR (A) | FUL (A) | SHU (A) | NEW (A) | LIV | ARS | MCI (A) | EVE (A) | CRY | AVL | BRE (A) | MUN | CHE | LUT (A) | BOU | WHU | BHA | WOL | NFO (A) | TOT (A) |
| 13 | BRE | TOT | NFO | SHU | ARS (A) | WHU (A) | NEW | LUT | MUN (A) | WOL (A) | MCI | CRY (A) | LIV (A) | EVE | CHE (A) | BHA (A) | BOU (A) | AVL (A) | BUR | FUL |
| 14 | WOL (A) | BOU | CHE | AVL (A) | LUT (A) | SHU (A) | BHA (A) | WHU | NFO | LIV | FUL (A) | BRE | TOT (A) | NEW | MUN (A) | EVE (A) | BUR | MCI | CRY (A) | ARS |
| 15 | LUT | MCI (A) | BRE (A) | CRY | BHA | WOL | MUN | BOU (A) | NEW (A) | NFO (A) | SHU | ARS (A) | AVL | CHE (A) | EVE | FUL | LIV (A) | WHU (A) | TOT | BUR (A) |
| 16 | AVL | ARS (A) | BUR (A) | MUN | SHU | BHA | EVE | LIV (A) | CHE (A) | WHU (A) | CRY | MCI (A) | LUT | BOU (A) | TOT | WOL | BRE (A) | NEW (A) | FUL | NFO (A) |
| 17 | BHA (A) | BRE | ARS | AVL (A) | EVE (A) | SHU (A) | MCI | BUR | NEW | MUN (A) | CRY (A) | LIV | FUL (A) | TOT (A) | CHE | NFO | WOL (A) | WHU | ||
| 18 | LIV | SHU (A) | CRY | NFO | FUL | WOL | BHA (A) | TOT | BUR (A) | ARS (A) | NEW (A) | WHU | LUT | BOU (A) | AVL | EVE (A) | MUN (A) | CHE (A) | ||
| 19 | WHU (A) | MUN | TOT (A) | FUL (A) | WOL (A) | LIV (A) | CRY (A) | CHE | MCI (A) | BOU | BUR | SHU | EVE | AVL (A) | NFO (A) | NEW | LUT (A) | BHA | ARS | BRE |
| 20 | FUL | BUR (A) | WHU | TOT | CRY | AVL | LUT | BRE (A) | WOL | ARS (A) | NEW (A) | CHE (A) | SHU (A) | NFO | LIV | MUN (A) | MCI | BOU (A) | BHA (A) | EVE (A) |
| 21 | CRY (A) | EVE | WOL (A) | LIV (A) | NFO (A) | LUT (A) | FUL (A) | ARS | AVL (A) | CHE | BOU | BUR | NEW | TOT (A) | MCI (A) | BRE | WHU (A) | MUN | SHU | BHA |
| 22 | NFO | NEW (A) | LUT | WHU | TOT | MCI | LIV | SHU (A) | FUL | EVE (A) | CHE (A) | BHA (A) | BUR (A) | WOL | AVL | ARS (A) | CRY | BRE (A) | BOU (A) | MUN (A) |
| 23 | LIV (A) | SHU | CRY (A) | NFO (A) | MCI (A) | FUL (A) | WOL (A) | BHA | TOT (A) | BUR | ARS | NEW | BRE | WHU (A) | LUT (A) | BOU | AVL (A) | EVE | MUN | CHE |
| 24 | WHU | MUN (A) | TOT | FUL | WOL | LIV | CRY | CHE (A) | MCI | BOU (A) | BUR (A) | SHU (A) | EVE (A) | AVL | NFO | NEW (A) | LUT | BHA (A) | ARS (A) | BRE (A) |
| 25 | BUR | FUL | SHU | NEW | MCI, LIV (A) | ARS (A) | MCI | EVE | CRY (A) | AVL (A) | BRE, LUT (A) | LIV, MUN (A) | CHE (A), BRE (A) | LUT | BOU (A) | WHU (A) | BHA (A) | WOL (A) | NFO | TOT |
| 26 | NEW (A) | NFO (A) | EVE (A) | MCI (A) | WHU | CRY | BUR (A) | BHA | MUN | BOU | FUL (A) | ARS | AVL | WOL | BRE (A) | SHU (A) | ||||
| 27 | SHU | LUT | FUL | BUR | CHE (A) | BOU (A) | BRE | TOT | WHU (A) | BHA (A) | NFO | AVL (A) | MUN (A) | MCI | WOL (A) | LIV (A) | ARS (A) | CRY (A) | EVE | NEW |
| 28 | BRE (A) | TOT (A) | NFO (A) | SHU (A), LUT (A) | ARS | WHU | NEW (A) | LUT (A) | MUN | WOL | MCI (A) | CRY, BOU | LIV | EVE (A) | CHE | BHA | BOU | AVL | BUR (A) | FUL (A) |
| 29 | WHU | BUR | BRE (A) | TOT (A) | NFO (A) | LUT | FUL | AVL (A) | ||||||||||||
| 30 | MCI | WOL (A) | LIV | EVE (A) | MUN (A) | CHE | BUR (A) | NFO | BOU | SHU | BHA (A) | TOT | ARS (A) | BRE | WHU (A) | CRY (A) | FUL (A) | LUT (A) | NEW | AVL |
| 31 | LUT (A) | MCI | BRE | CRY (A) | BHA (A) | WOL (A) | MUN (A) | BOU | NEW | NFO | SHU (A) | ARS | AVL (A) | CHE | EVE (A) | FUL (A) | LIV | WHU | TOT (A) | BUR |
| 32 | BHA | BRE (A) | ARS (A) | LUT | AVL | EVE | SHU | MCI (A) | BUR (A) | NEW (A) | MUN | BOU (A) | CRY | LIV (A) | FUL | TOT | CHE (A) | NFO (A) | WOL | WHU (A) |
| 33 | AVL (A) | ARS | BUR | MUN (A) | SHU (A) | BHA (A) | EVE (A) | LIV | CHE | WHU | CRY (A) | MCI | LUT (A) | BOU | TOT (A) | WOL (A) | BRE | NEW | FUL (A) | NFO |
| 34 | WOL, CHE (A) | BOU (A) | MCI (A) | AVL, WOL | LUT | SHU | ARS | WHU (A), NEW (A) | NFO (A), LIV (A) | LIV (A) | FUL, EVE | BRE (A) | BHA | SHU (A) | CRY | EVE | MUN, BUR (A) | CRY | ARS (A), BOU (A) | |
| 35 | TOT | CHE (A) | BOU | BHA (A) | EVE | MUN | AVL, TOT (A) | FUL | BRE (A) | CRY (A) | WHU | WOL | NFO | BUR (A) | SHU (A) | MCI (A) | NEW | CHE, ARS (A) | LIV (A) | LUT (A) |
| 36 | BOU (A) | BHA | AVL (A) | ARS | FUL (A) | NEW (A) | WHU (A) | MUN (A) | LUT | BRE | TOT (A) | EVE (A) | WOL (A) | CRY | BUR | SHU | NFO (A) | LIV | CHE | MCI |
| 37 | MUN | LIV (A) | NEW, CHE (A) | BRE (A) | BOU | TOT | NFO, BHA | WOL | SHU (A) | MCI (A) | AVL | WHU | FUL, TOT | ARS (A), NEW (A) | MUN, BHA (A) | CHE (A) | EVE | BUR (A), MCI (A) | LUT (A) | CRY (A) |
| 38 | EVE (A) | CRY | MUN (A) | CHE | NEW (A) | NFO (A) | BOU (A) | AVL (A) | ARS | LUT | WOL (A) | FUL (A) | WHU (A) | BHA | BRE | BUR | TOT (A) | SHU | MCI | LIV |
Source:
What is this?
This is an evolving set of data and graphs relating to the English Premier League and the Fantasy Football competition associated with it.
These pages are a mechanism for me to learn R, markdown, ggplot2 and other graphing techniques in R. These pages are built using markdown and flexdashboard.
If time allows, I hope to add to and improve the graphs as time passes and my knowledge improves.
All data is sourced from the links below and then mangled into shape by my embarassingly hideous code.
Disclaimer:
Feedback:
If you wish to leave constructive feedback or suggestions or have any questions then you can get me here: superboreen at gmail dot com
Data Sources:
R-related Links.
---
title: "Superboreen Premier League & Fantasy Data 2023-2024."
output:
flexdashboard::flex_dashboard:
source_code: embed
orientation: columns
vertical_layout: scroll
smooth_scroll: true
---
```{r, environment, echo=FALSE}
# RPUBS Information
# Superboreen Premier League Fantasy 2023 2024
# Updated regularly. Another season's evolving set of data and graphs relating to the English Premier League and the Fantasy Football competition associated with it.
# prem_fpl_2023_2024
# https://rpubs.com/superboreen/prem_fpl_2023_2024
#options(scipen = 1000) # prevent scientific notation in graph axes
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(flexdashboard))
suppressPackageStartupMessages(library(formattable))
suppressPackageStartupMessages(library(ggiraph)) # review: why?
suppressPackageStartupMessages(library(ggplot2))
suppressPackageStartupMessages(library(ggrepel))
suppressPackageStartupMessages(library(ggridges))
suppressPackageStartupMessages(library(Hmisc))
suppressPackageStartupMessages(library(lubridate))
suppressPackageStartupMessages(library(patchwork))
suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(reactable))
suppressPackageStartupMessages(library(htmltools))
suppressPackageStartupMessages(library(sparkline))
suppressPackageStartupMessages(library(reactablefmtr)) # remotes::install_github("kcuilla/reactablefmtr")
# suppressPackageStartupMessages(library(webshot2)) # remotes::install_github("rstudio/webshot2")
```
```{r, timestamp, echo=FALSE}
# CREATE TIMESTAMP AND DATESTAMP ====
x <- Sys.time()
timestamp <- lubridate::parse_date_time(x, "%Y%m% d%H%M%S", truncated = 3)
timestamp <- gsub("[[:punct:]]", "-",timestamp)
timestamp <- gsub("\\s", "-",timestamp)
datestamp <- as.character(lubridate::date(x))
rm(x)
```
```{r import_data, echo=FALSE, eval=TRUE}
d003510_bound_league_match_results <- readRDS(here::here("data","out","d3510_bound_league_match_results.rds"))
d003530_premtable_published <- readRDS(here::here("data","out","d3530_premtable_published.rds"))
d003690_dreamteam <- readRDS(here::here("data","out","d3690_dreamteam.rds"))
d003692_fpl_player_teams_joined <- readRDS(here::here("data","out","d3692_fpl_player_teams_joined.rds"))
d003693_fpl_get_player_all_latest_news <-
readRDS(here::here("data", "out", "d3693_fpl_get_player_all_latest_news.rds")) %>%
arrange(desc(news_added))
```
```{r import_data1, echo=FALSE}
d001395_fixtures_and_teams_wide_transpose <-
readRDS(here::here("data", "out",
"d1395_fixtures_and_teams_wide_transpose.rds"))
```
Wins, Draws, Losses, Goals, Form. {data-navmenu="Menu"}
=====================================
Column {data-width=500}
-------------------------------------
### Wins, Draws, Losses, Goals, 2023-2024.
```{r, prem_goals_and_results, echo=FALSE, eval = TRUE}
plot.title = "Premier League Goals and Results, 2023-2024."
plot.subtitle = paste0("Last updated: ",datestamp)
# this is a hack to stop the goals axis showing decimal points
d003510_bound_league_match_results$FT_Goals <-
factor(d003510_bound_league_match_results$FT_Goals)
ggplot(d003510_bound_league_match_results, aes(x = Date, y = FT_Goals, group = Result)) +
facet_wrap(~Team) +
theme(legend.title = element_blank()) +
ggtitle(bquote(atop(.(plot.title), atop(italic(.(plot.subtitle)), "")))) +
ylab("Goals.") +
xlab("Date.") +
geom_point(aes(colour = Result, shape = Venue) , size = 1.5) +
scale_colour_manual(values=c("blue", "red", "green")) +
theme_bw() +
theme(axis.text.x = element_text(size=6, angle = 90, hjust = 1), axis.title = element_text(size = 8,face = "bold")) +
theme(axis.text.y = element_text(size=5, angle = 0, hjust = 1), axis.title = element_text(size = 8,face = "bold")) +
theme(strip.text.x = element_text(size = 6, colour = "black", angle = 0))
ggsave(here::here("plots/prem_goals_and_results.png"))
```
Premier League Table (Sortable). {data-navmenu="Menu"}
=====================================
Column {data-width=600}
-------------------------------------
### Premier League Table.
The table below can be re-sorted by clicking on the column headers.
```{r echo=FALSE, eval=TRUE}
library(reactable)
library(reactablefmtr)
reactable::reactable(
d003530_premtable_published,
compact = TRUE,
defaultColDef = colDef(headerClass = "header", align = "left"),
defaultSorted = "Pos",
highlight = TRUE,
pagination = FALSE,
striped = FALSE,
showSortable = T,
theme = reactableTheme(
borderColor = "#dfe2e5",
stripedColor = "#f6f8fa",
highlightColor = "lightblue1",
cellPadding = "8px 12px",
style = list(fontFamily = "-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif"),
searchInputStyle = list(width = "100%")
),
columns = list(
Pts = colDef(
name = "Points.",
maxWidth = 75,
align = "left",
cell = data_bars(d003530_premtable_published, c("#04f5ff"), bar_height = 7, text_position = "outside-end", background = "transparent")
),
Pos = colDef(
maxWidth = 60,
name = "Pos.",
align = "right"
),
Team = colDef(
name = "Team",
minWidth = 130,
resizable = TRUE
),
Pld = colDef(
name = "Played",
maxWidth = 75,
align = "center",
),
W = colDef(
style = list(fontFamily = "monospace", whiteSpace = "pre"),
name = "Won.",
maxWidth = 75,
align = "left",
cell = data_bars(d003530_premtable_published, c("#00ff85"), bar_height = 7, text_position = "outside-end", background = "transparent")
),
D = colDef(
style = list(fontFamily = "monospace", whiteSpace = "pre"),
name = "Drawn.",
maxWidth = 75,
align = "left",
cell = data_bars(d003530_premtable_published, bar_height = 7, text_position = "outside-end", background = "transparent")
),
L = colDef(
style = list(fontFamily = "monospace", whiteSpace = "pre"),
name = "Lost.",
maxWidth = 75,
align = "left",
cell = data_bars(d003530_premtable_published, c("#e90052"), bar_height = 7, text_position = "outside-end", background = "transparent")
),
GF = colDef(
name = "Goals For",
maxWidth = 75,
align = "left",
cell = data_bars(d003530_premtable_published, c("#00ff85"), bar_height = 7, text_position = "outside-end", background = "transparent")
),
GA = colDef(
name = "Goals Against.",
maxWidth = 80,
align = "left",
cell = data_bars(d003530_premtable_published, c("#e90052"), bar_height = 7, text_position = "outside-end", background = "transparent")
),
GD = colDef(
name = "Goal Diff.",
maxWidth = 100,
align = "center",
cell = data_bars(
d003530_premtable_published,
fill_color = c("red", "green"),
bar_height = 7, text_position = "outside-end"
)
),
median_home_goals = colDef(
name = "Median Home Goals.",
maxWidth = 75,
align = "center",
cell = data_bars(d003530_premtable_published, bar_height = 7, text_position = "outside-end", background = "transparent")
),
median_away_goals = colDef(
name = "Median Away Goals.",
maxWidth = 75,
align = "center",
cell = data_bars(d003530_premtable_published, bar_height = 7, text_position = "outside-end", background = "transparent")
),
yellow_cards = colDef(
name = "Yellow Cards",
maxWidth = 75,
align = "left"
),
red_cards = colDef(
name = "Red Cards",
maxWidth = 75,
align = "left"
),
shots = colDef(
name = "Shots",
maxWidth = 75,
align = "left",
cell = data_bars(d003530_premtable_published, c("#38003c"), bar_height = 7, text_position = "outside-end", background = "transparent")
),
shots_diff = colDef(
name = "Shots Diff.",
maxWidth = 100,
align = "center",
cell = data_bars(
d003530_premtable_published,
fill_color = c("red", "green"),
bar_height = 7, text_position = "outside-end"
)
) ,
goals = colDef(name="Goals",
cell = function(values) {
sparkline(
values,
type = "bar",
barColor = "green",
chartRangeMin = 0,
chartRangeMax = max(as.integer(d003510_bound_league_match_results$FT_Goals))
)
}
),
goals_boxplot = colDef(
name = "Goals Distribution",
cell = function(value, index) {
sparkline(d003530_premtable_published$goals[[index]], type = "box")
}
) ,
form = colDef(
cell = function(values) {
sparkline(values, type = "tristate")
}
)
)
)
# references
# https://omnipotent.net/jquery.sparkline/#s-about
```
Fixtures. {data-navmenu="Menu"}
=====================================
Column {data-width=1600}
-------------------------------------
```{css}
.chart-shim {
overflow: auto;
}
```
### Fixtures.
```{r echo=FALSE, eval=TRUE, eval=TRUE}
my_data <- d001395_fixtures_and_teams_wide_transpose
my_data |>
gt::gt() |>
gt::tab_options(
table.font.size = 12
) %>%
gt::tab_header(
title = "Premier League Fixtures 2023-2024.",
subtitle = "Teams in pink are away (A).") %>%
gt::tab_style(
style = list(
gt::cell_fill(color = 'pink'),
gt::cell_text(weight = 'normal')),
locations = names(my_data) |>
lapply(FUN = \(col_name){
gt::cells_body(columns = col_name,
rows = grepl('A)', my_data[[col_name]])
)
})
)
```
Cost vs Total Points, Value. {data-navmenu="Menu"}
=====================================
Column
-------------------------------------
### Cost vs Total Points.
```{r, echo = FALSE, eval = TRUE}
library(plotly)
fig <- d003692_fpl_player_teams_joined %>%
plot_ly(
type = 'scatter',
mode = 'markers',
y = ~total_points,
x = ~now_cost,
# marker = list(size = ~value_season),
marker = list(size = 10),
color = ~singular_name_short,
# color = ~second_name,
# text = ~web_name,
text = ~second_name,
hovertemplate = paste(
"<b>%{text}</b><br><br>",
"%{yaxis.title.text}: %{y:,.0f}<br>",
"%{xaxis.title.text}: %{x}<br>",
"<extra></extra>"
)
) %>% layout(title = "<b>Player Cost, Points.",
yaxis = list(title = "Total Points."),
xaxis = list(title = "Cost Now."),
showlegend = TRUE,
legend = list(orientation = 'v', y = .5))
fig
# https://plotly-r.com/controlling-tooltips.html
```
Column {data-width=500}
-------------------------------------
### Value vs Cost. {data-navmenu="Menu"}
```{r, echo = FALSE, eval=TRUE}
library(plotly)
fig <- d003692_fpl_player_teams_joined %>%
#fig <- d003692_fpl_player_teams_joined %>%
plot_ly(
type = 'scatter',
mode = 'markers',
y = ~value_season,
x = ~now_cost,
# marker = list(size = ~value_season),
marker = list(size = 10),
color = ~singular_name_short,
text = ~web_name,
hovertemplate = paste(
"<b>%{text}</b><br><br>",
"%{yaxis.title.text}: %{y:,.0f}<br>",
"%{xaxis.title.text}: %{x}<br>",
"<extra></extra>"
)
) %>% layout(title = "<b>Player Cost, Value.",
yaxis = list(title = "Value (Season)."),
xaxis = list(title = "Cost Now."),
showlegend = TRUE,
legend = list(orientation = 'v', y = .5))
fig
# https://plotly-r.com/controlling-tooltips.html
```
Dream Team. {data-navmenu="Menu"}
=====================================
Row {data-height=600}
-------------------------------------
### Dreamteam.
```{r, eval=TRUE}
# remove:?
# var.labels = c(total_points="Total Points",
# now_cost = "Cost")
# label(dreamteam) = as.list(var.labels[match(names(dreamteam), names(var.labels))])
# re-order the columns by selecting in the required order
# remove:?
# dreamteam <- dreamteam %>%
# select("second_name",
# "short_name",
# "total_points",
# "selected_by_percent",
# "now_cost",
# "transfers_in",
# "transfers_out",
# "minutes",
# "value_season")
reactable::reactable(d003690_dreamteam,
compact = TRUE,
pagination = FALSE,
highlight = TRUE,
striped = FALSE,
showSortable = T,
defaultColDef = colDef(headerClass = "header", align = "left"),
defaultSorted = "total_points",
theme = reactableTheme(
borderColor = "#dfe2e5",
stripedColor = "#f6f8fa",
highlightColor = "lightblue1",
cellPadding = "8px 12px",
style = list(fontFamily = "-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif"),
searchInputStyle = list(width = "100%")),
columns = list(
second_name = colDef(
name = "Name.",
maxWidth = 200,
align = "left"
),
short_name = colDef(
name = "Team.",
maxWidth = 150,
align = "left"
)
,
total_points = colDef(
name = "Total Points.",
maxWidth = 150,
align = "left",
cell = data_bars(d003690_dreamteam, c("#04f5ff"), text_position = "outside-end")#,
# text_position = "outside-base")
),
selected_by_percent = colDef(
style = list(fontFamily = "monospace", whiteSpace = "pre"),
name = "Selected By %.",
maxWidth = 150,
align = "left",
cell = data_bars(d003690_dreamteam, c("#04f5ff"), text_position = "outside-end")#,
# text_position = "outside-base")
),
now_cost = colDef(
style = list(fontFamily = "monospace", whiteSpace = "pre"),
name = "Now Cost.",
maxWidth = 150,
align = "left",
cell = data_bars(d003690_dreamteam, c("#04f5ff"), text_position = "outside-end")#,
),
transfers_in = colDef(
name = "Transfers In.",
maxWidth = 200,
align = "left",
format = colFormat(digits = 1, separators = TRUE, locales = "en-IE"),
cell = data_bars(d003690_dreamteam, c("green"), text_position = "outside-end")#,
),
transfers_out = colDef(
name = "Transfers Out.",
maxWidth = 200,
align = "left",
cell = data_bars(d003690_dreamteam, c("red"), text_position = "outside-end")#,
),
minutes = colDef(
name = "Minutes.",
maxWidth = 150,
align = "left",
cell = data_bars(d003690_dreamteam, c("#04f5ff"), text_position = "outside-end")#,
),
value_season = colDef(
name = "Value Season.",
maxWidth = 150,
align = "left",
cell = data_bars(d003690_dreamteam, c("#04f5ff"), text_position = "outside-end")#,
)
)) %>% reactablefmtr::add_title("Dreamteam - Premier League Fantasy Football.") %>%
reactablefmtr::add_subtitle("Click on the column headers to sort.") %>%
reactablefmtr::add_source("Source:")
```
News. {data-navmenu="Menu"}
=====================================
Row {data-orientation=rows}
-------------------------------------
### News.
```{r, eval=TRUE}
reactable(
d003693_fpl_get_player_all_latest_news,
fullWidth = TRUE,
striped = TRUE,
defaultColDef = colDef(
# width = 150,
headerClass = "header",
align = "left"
),
defaultSorted = "news_added",
defaultSortOrder = "desc",
highlight = TRUE,
bordered = FALSE,
showSortable = T,
theme = reactableTheme(
borderColor = "#dfe2e5",
stripedColor = "#f6f8fa",
highlightColor = "lightblue1",
cellPadding = "2px 2px",
style = list(fontFamily = "-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif"),
searchInputStyle = list(width = "100%")
),
defaultPageSize = 25,
compact = FALSE,
columns = list(
news = colDef(
name = "News.",
maxWidth = 400,
align = "left"
),
first_name = colDef(
name = "First Name.",
maxWidth = 100,
align = "left"
),
second_name = colDef(
name = "News.",
maxWidth = 100,
align = "left"
),
news_added = colDef(
name = "Date.",
maxWidth = 100,
align = "left"
)
)
)
```
About. {data-navmenu="Menu"}
=====================================
**What is this?**
This is an evolving set of data and graphs relating to the English Premier League and the Fantasy Football competition associated with it.
These pages are a mechanism for me to learn R, markdown, ggplot2 and other graphing techniques in R. These pages are built using markdown and flexdashboard.
If time allows, I hope to add to and improve the graphs as time passes and my knowledge improves.
All data is sourced from the links below and then mangled into shape by my embarassingly hideous code.
**Disclaimer:**
- I don't know enough about football.
- I don't know enough about R etc.
- Everything might break or change without notice.
- Any mistakes are mine.
**Feedback:**
If you wish to leave constructive feedback or suggestions or have any questions then you can get me here: __superboreen at gmail dot com__
**Data Sources:**
- https://fantasy.premierleague.com/
- The superb https://jaseziv.github.io/worldfootballR/ R package
**R-related Links.**
- http://rmarkdown.rstudio.com/flexdashboard/index.html
- https://jaseziv.github.io/worldfootballR/
- The excellent reactablefmtr package https://kcuilla.github.io/reactablefmtr/index.html
```{css, echo=FALSE}
.premier_league_table {
margin: 0 auto;
width: 1400px;
font-family: Karla, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.title {
margin: 18px 0;
font-size: 16px;
}
.title h2 {
font-size: 16px;
font-weight: 600;
}
.new_cases_per_million-tbl {
font-size: 14px;
line-height: 18px;
}
.new_cases_per_million-tbl a {
color: inherit;
}
.header {
border-bottom: 2px solid #555;
font-size: 12px;
font-weight: 400;
text-transform: uppercase;
}
.header:hover {
background-color: #eee;
}
.bar-cell {
display: flex;
align-items: center;
}
.number {
font-family: "Fira Mono", Consolas, Monaco, monospace;
font-size: 12px;
white-space: pre;
}
.bar-chart {
flex-grow: 1;
margin-left: 6px;
height: 14px;
}
.bar {
height: 100%;
}
```
```{css echo=FALSE}
/* rmarkdown html documents */
h1.title {
display: none;
}
```