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

Documentation and title for Y axis function

parent bf4e6d8f
Branches
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ setwd("/home/mariogt/TFGs/Estadistica/")
#####################################
# FUNCIONES #
#####################################
# Returns the distribution of a variable from 3 seasons with a bar plot.
plotFor3Seasons <- function(data, variable) {
par(mfrow = c(1, 3))
dfs <- list()
......@@ -41,6 +42,7 @@ plotFor3Seasons <- function(data, variable) {
}
}
# Returns two plots to analize a variable in a longitudinal data.
univariantAnalysis <- function(data, variable, ids) {
info <- data %>% select(contains(paste(variable, ".", sep = "")))
info <- cbind(ids, info)
......@@ -66,6 +68,35 @@ univariantAnalysis <- function(data, variable, ids) {
figure
}
# Returns the spanish title of the Y-axis according to the variable entered by parameter.
titleForYAxis <- function(variable) {
title <- switch(variable,
age = "Edad",
height = "Estatura",
foot = "Pierna buena",
goals_assists_per90 = "Goles y asistencias por 90 min",
xg = "Goles esperados (xG)",
npx = "Goles esperados no de penalti (npxG)",
xa = "Asistencias esperadas (xA)",
shots_on_target_pct = "Porcentaje de tiros a puerta",
passes_pct = "Porcentaje de pases completados",
passes_total_distance = "Distancia total recorrida por sus pases",
assisted_shots = "Pases que generan un tiro",
passes_switches = "Pases que cambian la orientacion del juego",
sca_passes_dead = "Acciones de creación de tiro a balon parado",
gca_passes_dead = "Acciones de creación de gol a balon parado",
passes_intercepted = "Pases interceptados",
pressure_regains = "Porcentaje de presiones exitosas",
dribbles_completed_pct = "Porcentaje de regates exitosos",
fouls = "Faltas cometidas",
aerials_won_pct = "Porcenaje de balones aéreos ganados",
pens_att = "Penalties atajados",
goals_against_per90_gk = "Goles en contra por 90 min (GK)",
save_pct = "Porcentaje de ocasiones paradas",
"Variable no encontrada")
return(title)
}
#############
# LIBRERIAS #
#############
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment