Skip to content
Snippets Groups Projects
Commit 58b6cbad authored by Mario Garrido Tapias's avatar Mario Garrido Tapias
Browse files

Proportion table for position distribution

parent 1bed8e57
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,6 @@ plotFor3SeasonsForPos <- function(data, variable) {
position = c("Portero", "Defensa", "Mediocentro", "Delantero"),
numberOf = c(numGK, numDF, numMF, numFW)
)
cat(df$numberOf)
dfs[[i]] <- df
if(maxPInPos < max(df$numberOf)) {
maxPInPos <- max(df$numberOf)
......@@ -60,6 +59,8 @@ plotFor3SeasonsForPos <- function(data, variable) {
main= paste(c("Distribución posiciones ", season, "(TRAIN)"), sep = ""),
ylim = c(0, maxPInPos)
)
tabla <- table(rep(c("GK", "DF", "MF", "FW"), times = dfs[[i]]$numberOf))
cat(prop.table(tabla), "\n")
}
}
......@@ -85,7 +86,7 @@ univariantAnalysis <- function(data, variable, ids) {
figure <- ggarrange(bp, gp,
labels = c("A", "B"),
ncol = 1, nrow = 2)
ncol = 2, nrow = 1)
figure
}
......@@ -121,7 +122,7 @@ titleForYAxis <- function(variable) {
#############
# LIBRERIAS #
#############
library(tidyverse)
library(tidyverse) # filter(), select(), contains()
library(reshape)
library(tidyr) # gather() -> WIDE data to LONG data
library(ggplot2) # graphics
......@@ -175,7 +176,7 @@ ids <- t(ids)
#############################
# Pases que derivan en tiro #
#############################
plotFor3Seasons(train, "assisted_shots")
barpFor3Season(train, "assisted_shots")
univariantAnalysis(train, "assisted_shots", ids)
###################################
# Cambios de orientación de juego #
......@@ -220,3 +221,6 @@ ids <- t(ids)
univariantAnalysis(train, "")
laLigaPlayers$foot <- as.factor(laLigaPlayers$foot)
# Tamaño box y promedio: 1200x400´
# Tamaño histogramas : 1200x450
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment