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

Quit goalkeepers parameter

parent 0009951e
No related branches found
No related tags found
No related merge requests found
......@@ -226,14 +226,16 @@ scatterForCorr(laLigaPlayersStudy, "saves", "shots_on_target_against", col = "#4
# 2nda SELECCION
# Quitamos: "passes_total_distance.", "xg.", "assisted_shots.", "goals_against_per90_gk.", "shots_on_target_against.",
variables <- c("xa.", "passes.", "passes_pct.", "passes_switches.",
if (quitarPorteros == 0) {
variables <- c("age", "height",
"xa.", "passes.", "passes_pct.", "passes_switches.",
"pass_targets.", "passes_received_pct.", "passes_pressure.",
"npxg.", "shots_total.", "shots_on_target_pct.", "pens_att.", "pens_made_pct.",
"dribbles.", "dribbles_completed_pct.", "goals_assists_per90.",
"sca_passes_dead.", "gca_passes_dead.", "sca_passes_live.", "gca_passes_live.", "sca_dribbles.", "gca_dribbles.", "sca_fouled.", "gca_fouled.",
"passes_intercepted.", "ball_recoveries.", "pressure_regains.", "fouls.", "tackles.", "tackles_pct.", "aerials_contested.", "aerials_won_pct.",
"pens_played.", "pens_saved_pct.", "saves.", "save_pct.")
} else {
variables <- c("age", "height",
"xa.", "passes.", "passes_pct.", "passes_switches.",
"pass_targets.", "passes_received_pct.", "passes_pressure.",
......@@ -241,6 +243,8 @@ variables <- c("age", "height",
"dribbles.", "dribbles_completed_pct.", "goals_assists_per90.",
"sca_passes_dead.", "gca_passes_dead.", "sca_passes_live.", "gca_passes_live.", "sca_dribbles.", "gca_dribbles.", "sca_fouled.", "gca_fouled.",
"passes_intercepted.", "ball_recoveries.", "pressure_regains.", "fouls.", "tackles.", "tackles_pct.", "aerials_contested.", "aerials_won_pct.")
}
globalColNames <- c()
for (variable in variables) {
variable <- gsub("\\.", "", variable)
......@@ -249,18 +253,36 @@ for (variable in variables) {
laLigaPlayersStudy <- laLigaPlayersStudy %>% select(all_of(globalColNames))
laLigaPlayersStudy <- data.frame(lapply(laLigaPlayersStudy, as.numeric))
laLigaPlayersStudyStand <- data.frame(scale(laLigaPlayersStudy))
laLigaPlayersStudy$player <- laLigaPlayersStudyAux$player
repeatedPlayers <- which(duplicated(laLigaPlayersStudy$player) == TRUE)
playersIn2Clubs <- laLigaPlayersStudy$player[repeatedPlayers]
rowsPIn2C <- c()
for (name in playersIn2Clubs) {
rowsPIn2C <- rbind(rowsPIn2C, which(laLigaPlayersStudy$player == name))
}
rownames(rowsPIn2C) <- playersIn2Clubs
rowsPIn2C
#comprueba que x tiene columnas estandarizadas
apply(laLigaPlayersStudyStand,2,mean)
apply(laLigaPlayersStudyStand^2,2,mean)
correlacion <- round(cor(laLigaPlayersStudyStand), 1)
p.mat <- cor_pmat(laLigaPlayersStudyStand)
mypalette <- brewer.pal(n = 3, name = 'BuPu')
ggcorrplot(correlacion, type = "upper",
title = "Matriz de correlaciones ordenada",
title = "Matriz de correlaciones Pearson ordenada",
hc.order = FALSE, lab = TRUE,
pch.cex = 1.2, lab_size = 2.5, tl.cex = 9,
colors = mypalette, ggtheme = ggplot2::theme_gray, p.mat = p.mat, insig = "blank")
correlacion <- round(cor(laLigaPlayersStudyStand, method = "spearman"), 1)
ggcorrplot(correlacion, type = "upper",
title = "Matriz de correlaciones ordenada",
title = "Matriz de correlaciones Spearman ordenada",
hc.order = FALSE, lab = TRUE,
pch.cex = 1.2, lab_size = 2.5, tl.cex = 9,
colors = mypalette, ggtheme = ggplot2::theme_gray, p.mat = p.mat, insig = "blank")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment