-
Notifications
You must be signed in to change notification settings - Fork 1
/
dashboard.Rmd
85 lines (73 loc) · 2.02 KB
/
dashboard.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
title: "Explora la copa mundial FIFA desde el 1930-2014 ⚽"
output:
flexdashboard::flex_dashboard:
theme:
version: 4
bootswatch: journal
base_font:
google: Prompt
code_font:
google: JetBrains Mono
orientation: columns
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
library(here)
library(tidyverse)
library(DT)
library(plotly)
thematic::thematic_rmd(font = "auto")
partidos <- read.csv("data/WorldCupMatches.csv")
jugadores <- read.csv("data/WorldCupPlayers.csv")
copas <- read.csv("data/WorldCups.csv")
```
Column {data-width=650 .tabset}
-----------------------------------------------------------------------
### 🏆 Los campeones del mundial
```{r}
ggplotly(copas %>%
mutate(Winner = case_when(Winner == "Germany FR" ~ "Germany",
TRUE ~ Winner)) %>%
count(Winner) %>%
ggplot(aes(x=reorder(Winner,n), y=n)) +
geom_col() +
xlab("Campeón") +
theme_minimal())
```
### ⚽ Número de goles
```{r}
ggplotly(copas %>%
ggplot(aes(x=Year, y=GoalsScored)) +
geom_line() +
geom_point() +
theme_minimal())
```
### 🏅Países en los top 4
```{r}
ggplotly(copas %>%
select(Winner:Fourth) %>%
pivot_longer(cols=Winner:Fourth, names_to="lugar", values_to="pais") %>%
mutate(pais = case_when(pais == "Germany FR" ~ "Germany",
TRUE ~ pais)) %>%
count(pais) %>%
ggplot(aes(x=reorder(pais,n), y=n)) +
geom_col() +
xlab("País") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45)))
```
### 🗒️Explora y descarga los datos
```{r}
datatable(copas,
extensions = "Buttons",
options = list(dom = "Bfrtip",
buttons = (list(
"copy", list(
extend = "collection",
buttons = c("csv", "excel"),
text = "Download")))),
rownames = F,
filter = "top")
```