Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GMTool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
margarr
GMTool
Commits
cd9a2de0
Commit
cd9a2de0
authored
Jun 14, 2022
by
Mario Garrido Tapias
Browse files
Options
Downloads
Patches
Plain Diff
order UA of the different groups of variables and little fix on his general function
parent
cb4e080d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
UnivariateAnalysis.R
+158
-29
158 additions, 29 deletions
UnivariateAnalysis.R
with
158 additions
and
29 deletions
UnivariateAnalysis.R
+
158
−
29
View file @
cd9a2de0
...
...
@@ -44,9 +44,8 @@ barpFor3Season <- function(data, variable) {
# Returns two plots to analize a variable in a longitudinal data.
univariantAnalysis
<-
function
(
data
,
variable
,
ids
,
nplots
)
{
info
<-
data
%>%
select
(
contains
(
paste
(
variable
,
"."
,
sep
=
""
)))
info
<-
data
%>%
select
(
starts_with
(
paste
(
variable
,
"."
,
sep
=
""
)))
info
<-
cbind
(
ids
,
info
)
cat
(
names
(
info
))
# WIDE to LONG
dl
<-
gather
(
info
,
season
,
variable
,
2
:
4
,
factor_key
=
TRUE
)
...
...
@@ -80,7 +79,7 @@ titleForYAxis <- function(variable) {
foot
=
"Pierna buena"
,
goals_assists_per90
=
"Goles y asistencias por 90 min"
,
xg
=
"Goles esperados (xG)"
,
npx
=
"Goles esperados no de penalti (npxG)"
,
npx
g
=
"Goles esperados no de penalti (npxG)"
,
xa
=
"Asistencias esperadas (xA)"
,
shots_on_target_pct
=
"Porcentaje de tiros a puerta"
,
passes_completed
=
"Pases realizados con éxito"
,
...
...
@@ -100,6 +99,7 @@ titleForYAxis <- function(variable) {
sca_fouled
=
"Acciones de creación de tiro tras falta"
,
gca_fouled
=
"Acciones de creación de gol tras falta"
,
passes_intercepted
=
"Pases interceptados"
,
ball_recoveries
=
"Balones recuperados"
,
pressure_regains
=
"Porcentaje de presiones exitosas"
,
dribbles
=
"Regates intentados"
,
dribbles_completed
=
"Regates conseguidos con éxito"
,
...
...
@@ -114,7 +114,7 @@ titleForYAxis <- function(variable) {
pens_made
=
"Penalties marcados"
,
pens_att
=
"Penalties intentados"
,
shots_on_target_against
=
"Tiros a puerta en contra"
,
goals_against_per90_gk
=
"Goles en contra por 90 min (
GK
)"
,
goals_against_per90_gk
=
"Goles en contra por 90 min (
Porteros
)"
,
pens_saved
=
"Penalties atajados"
,
pens_allowed
=
"Penalties no parados"
,
saves
=
"Paradas totales"
,
...
...
@@ -171,6 +171,8 @@ ids <- data.frame(laLigaPlayers$X)
# xA #
######
univariantAnalysis
(
laLigaPlayers
,
"xa"
,
ids
,
2
)
xa
<-
laLigaPlayersStudyAux
%>%
select
(
contains
(
"xa."
))
# Outlier -> Jugador 37 -> Lionel Messi
##############################
# Pases realizados con éxito #
##############################
...
...
@@ -183,9 +185,12 @@ ids <- data.frame(laLigaPlayers$X)
# Porcentaje de pases #
#######################
univariantAnalysis
(
laLigaPlayers
,
"passes_pct"
,
ids
,
2
)
passes_pct
<-
laLigaPlayersStudyAux
%>%
select
(
contains
(
"passes_pct."
))
laLigaPlayers
$
player
[
which.min
(
passes_pct
[,
3
])]
##################################
# Distancia total mediante pases #
##################################
distBarFor3Season
(
laLigaPlayers
,
"passes_total_distance"
)
univariantAnalysis
(
laLigaPlayers
,
"passes_total_distance"
,
ids
,
2
)
#############################
# Pases que derivan en tiro #
...
...
@@ -209,46 +214,152 @@ ids <- data.frame(laLigaPlayers$X)
###########################################
univariantAnalysis
(
laLigaPlayers
,
"passes_received_pct"
,
ids
,
2
)
##################################
# Goles y asistencias por 90 min #
##################################.
distBarFor3Season
(
train
,
"goals_assists_per90"
)
univariantAnalysis
(
train
,
"goals_assists_per90"
,
ids
,
2
)
######
# xG #
######
univariantAnalysis
(
train
,
"xg"
,
ids
)
univariantAnalysis
(
laLigaPlayersStudyAux
,
"xg"
,
ids
,
2
)
########
# npxG #
########
univariantAnalysis
(
train
,
"npxg"
,
ids
)
univariantAnalysis
(
laLigaPlayers
,
"npxg"
,
ids
,
2
)
#################
# Tiros totales #
#################
univariantAnalysis
(
laLigaPlayers
,
"shots_total"
,
ids
,
2
)
##########################
# Tiros a puerta totales #
##########################
univariantAnalysis
(
laLigaPlayers
,
"shots_on_target"
,
ids
,
2
)
################################
# Porcentaje de tiros a puerta #
################################
univariantAnalysis
(
laLigaPlayers
,
"shots_on_target_pct"
,
ids
,
2
)
##############
# Goles/tiro #
##############
univariantAnalysis
(
laLigaPlayers
,
"goals_per_shot"
,
ids
,
2
)
########################
# Penalties intentados #
########################
univariantAnalysis
(
laLigaPlayers
,
"pens_att"
,
ids
,
2
)
#########################
# Penalties convertidos #
#########################
univariantAnalysis
(
laLigaPlayers
,
"pens_made"
,
ids
,
2
)
#####################################
# Porcentaje de penalties con éxito #
#####################################
univariantAnalysis
(
laLigaPlayers
,
"pens_made_pct"
,
ids
,
2
)
##################################
#
Porcentaje de tiros a porteria
#
#
Goles y asistencias por 90 min
#
##################################
# univariantAnalysis(train, "xa", ids)
distBarFor3Season
(
laLigaPlayers
,
"goals_assists_per90"
)
univariantAnalysis
(
laLigaPlayers
,
"goals_assists_per90"
,
ids
,
2
)
##################################
# Porcentaje de regates exitosos #
##################################
univariantAnalysis
(
laLigaPlayers
,
"dribbles_completed_pct"
,
ids
,
2
)
dribbles_pct
<-
laLigaPlayers
%>%
select
(
all_of
(
"dribbles_completed_pct"
))
laLigaPlayersStudy
$
player
[
which
(
laLigaPlayersStudy
$
dribbles_completed_pct
==
0.0
)]
################
# SCA dribbles #
################
univariantAnalysis
(
laLigaPlayers
,
"sca_dribbles"
,
ids
,
2
)
################
# GCA dribbles #
################
univariantAnalysis
(
laLigaPlayers
,
"gca_dribbles"
,
ids
,
2
)
##############
# SCA fouled #
##############
univariantAnalysis
(
laLigaPlayers
,
"sca_fouled"
,
ids
,
2
)
fouled
<-
laLigaPlayersStudyAux
%>%
select
(
contains
(
"sca_fouled."
))
laLigaPlayers
$
player
[
which.max
(
fouled
[,
1
])]
laLigaPlayers
$
player
[
which.max
(
fouled
[,
2
])]
laLigaPlayers
$
player
[
which.max
(
fouled
[,
3
])]
##############
# GCA fouled #
##############
univariantAnalysis
(
laLigaPlayers
,
"gca_fouled"
,
ids
,
2
)
###################
# SCA passes live #
###################
univariantAnalysis
(
laLigaPlayers
,
"sca_passes_live"
,
ids
,
2
)
###################
# GCA passes live #
###################
univariantAnalysis
(
laLigaPlayers
,
"gca_passes_live"
,
ids
,
2
)
###################
# SCA passes dead #
###################
univariantAnalysis
(
train
,
"sca_passes_dead"
,
ids
)
univariantAnalysis
(
laLigaPlayers
,
"sca_passes_dead"
,
ids
,
2
)
###################
# GCA passes dead #
###################
univariantAnalysis
(
train
,
"gca_passes_dead"
,
ids
)
univariantAnalysis
(
laLigaPlayers
,
"gca_passes_dead"
,
ids
,
2
)
"fouls."
#######################
# Pases interceptados #
#######################
univariantAnalysis
(
train
,
"passes_intercepted"
,
ids
)
univariantAnalysis
(
laLigaPlayers
,
"passes_intercepted"
,
ids
,
2
)
intercepted
<-
laLigaPlayersStudyAux
%>%
select
(
contains
(
"passes_intercepted."
))
messi
<-
data.frame
(
laLigaPlayers
[
37
,])
%>%
select
(
contains
(
"intercepted"
))
laLigaPlayers
$
player
[
which.max
(
intercepted
[,
1
])]
laLigaPlayers
$
player
[
which.max
(
intercepted
[,
2
])]
laLigaPlayers
$
player
[
which.max
(
intercepted
[,
3
])]
#######################
# Balones recuperados #
#######################
univariantAnalysis
(
laLigaPlayers
,
"ball_recoveries"
,
ids
,
2
)
recoveries
<-
laLigaPlayersStudyAux
%>%
select
(
contains
(
"ball_recoveries."
))
laLigaPlayers
$
player
[
which.max
(
recoveries
[,
1
])]
laLigaPlayers
$
player
[
which.max
(
recoveries
[,
2
])]
laLigaPlayers
$
player
[
which.max
(
recoveries
[,
3
])]
######################
# Presiones exitosas #
######################
univariantAnalysis
(
laLigaPlayers
,
"pressure_regains"
,
ids
,
2
)
#######################
# Entradas realizadas #
#######################
univariantAnalysis
(
laLigaPlayers
,
"tackles"
,
ids
,
2
)
######################
# Entradas con éxito #
######################
univariantAnalysis
(
laLigaPlayers
,
"tackles_won"
,
ids
,
2
)
####################################
# Porcentaje de entradas con exito #
####################################
univariantAnalysis
(
laLigaPlayers
,
"tackles_pct"
,
ids
,
2
)
tackling
<-
laLigaPlayersStudyAux
%>%
select
(
contains
(
"tackles_pct."
))
laLigaPlayers
$
player
[
which.max
(
tackling
[,
1
])]
laLigaPlayers
$
tackles_won.1718
[
which.max
(
tackling
[,
1
])]
laLigaPlayers
$
player
[
which.max
(
tackling
[,
2
])]
laLigaPlayers
$
tackles_won.1819
[
which.max
(
tackling
[,
1
])]
laLigaPlayers
$
player
[
which.max
(
tackling
[,
3
])]
laLigaPlayers
$
tackles_won.1920
[
which.max
(
tackling
[,
1
])]
##########################
# Balones aereos ganados #
##########################
univariantAnalysis
(
laLigaPlayers
,
"aerials_won"
,
ids
,
2
)
#############################
# Balones aereos disputados #
#############################
univariantAnalysis
(
laLigaPlayers
,
"aerials_contested"
,
ids
,
2
)
#########################################
# Porcentaje de exito en balones aereos #
#########################################
univariantAnalysis
(
laLigaPlayers
,
"aerials_won_pct"
,
ids
,
2
)
####################################
# Porcentaje de presiones exitosas #
####################################
# univariantAnalysis(train, "xa", ids)
##################################
# Porcentaje de regates exitosos #
##################################
# univariantAnalysis(train, "xa", ids)
####################
# Faltas cometidas #
####################
...
...
@@ -257,18 +368,36 @@ ids <- data.frame(laLigaPlayers$X)
# Porcentaje de juegos aereos ganados #
#######################################
# univariantAnalysis(train, "xa", ids)
######################
# Penalties atajados #
######################
univariantAnalysis
(
train
,
"pens_att"
,
ids
)
#####################
# Penalties jugados #
#####################
univariantAnalysis
(
laLigaPlayers
,
"pens_played"
,
ids
,
2
)
#####################
# Penalties parados #
#####################
univariantAnalysis
(
laLigaPlayers
,
"pens_saved"
,
ids
,
2
)
#####################
# Porcentaje de penalties parados #
#####################
univariantAnalysis
(
laLigaPlayers
,
"pens_saved_pct"
,
ids
,
2
)
##############################
# Goles en contra por 90 min #
##############################
univariantAnalysis
(
train
,
"goals_against_per90_gk"
,
ids
)
univariantAnalysis
(
laLigaPlayers
,
"goals_against_per90_gk"
,
ids
,
2
)
############################
# Tiros a puerta del rival #
############################
univariantAnalysis
(
laLigaPlayers
,
"shots_on_target_against"
,
ids
,
2
)
###########
# Paradas #
###########
univariantAnalysis
(
laLigaPlayers
,
"saves"
,
ids
,
2
)
###################################
# Porcentaje de ocasiones paradas #
###################################
#
univariantAnalysis(
train, ""
)
univariantAnalysis
(
laLigaPlayers
,
"save_pct"
,
ids
,
2
)
laLigaPlayers
$
foot
<-
as.factor
(
laLigaPlayers
$
foot
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment