Explorar y generar tablas de distribución del conjunto de datas FIFA
Explorar determinando tablas y visualización de datos del conjunto de datos FIFA. Los datos se encuentran en la dirección: https://www.kaggle.com/karangadiya/fifa19?select=data.csv
El conjunto de datos data.csv incluye los atributos de los jugadores de la última edición de FIFA 2019 como Edad, Nacionalidad, Total, Potencial, Club, Valor, Salario, Pie preferido, Reputación internacional, Pie débil, Movimientos de habilidad, Ritmo de trabajo, Posición, Número de camiseta, Unido, Prestado desde, Contrato válido hasta , Altura, Peso, LS, ST, RS, LW, LF, CF, RF, RW, LAM, CAM, RAM, LM, LCM, CM, RCM, RM, LWB, LDM, CDM, RDM, RWB, LB, LCB , CB, RCB, RB, Centros, Remate, Rumbo, Precisión, Pases cortos, Voleas, Regate, Curva, FK Precisión, Pases largos, Control de balón, Aceleración, Sprint Velocidad, Agilidad, Reacciones, Equilibrio, Potencia de disparo, Salto, Resistencia, Fuerza, Tiros lejanos, Agresión , Intercepciones, Posicionamiento, Visión, Penalizaciones, Serenidad, Marcaje, Entrada de pie, Entrada deslizante, GKDiving, GKHandling, GKKicking, GKPositioning, GKReflexes y Cláusula de liberación.
library(readr) # Cargar datos csv
library(fdth) # Tablas de frecuencias
library(dplyr) # Filtros, Select, mutate, arrange, grou_by, summarize, %>%
library(lubridate) # Para manejo de fechas
library(ggplot2) # Para generar graficas
datos.fifa <- read.csv("../Datos/data FIFA.csv",encoding = "UTF-8")
head(datos.fifa, 10)
## X.U.FEFF. ID Name Age
## 1 0 158023 L. Messi 31
## 2 1 20801 Cristiano Ronaldo 33
## 3 2 190871 Neymar Jr 26
## 4 3 193080 De Gea 27
## 5 4 192985 K. De Bruyne 27
## 6 5 183277 E. Hazard 27
## 7 6 177003 L. Modric 32
## 8 7 176580 L. Suárez 31
## 9 8 155862 Sergio Ramos 32
## 10 9 200389 J. Oblak 25
## Photo Nationality
## 1 https://cdn.sofifa.org/players/4/19/158023.png Argentina
## 2 https://cdn.sofifa.org/players/4/19/20801.png Portugal
## 3 https://cdn.sofifa.org/players/4/19/190871.png Brazil
## 4 https://cdn.sofifa.org/players/4/19/193080.png Spain
## 5 https://cdn.sofifa.org/players/4/19/192985.png Belgium
## 6 https://cdn.sofifa.org/players/4/19/183277.png Belgium
## 7 https://cdn.sofifa.org/players/4/19/177003.png Croatia
## 8 https://cdn.sofifa.org/players/4/19/176580.png Uruguay
## 9 https://cdn.sofifa.org/players/4/19/155862.png Spain
## 10 https://cdn.sofifa.org/players/4/19/200389.png Slovenia
## Flag Overall Potential Club
## 1 https://cdn.sofifa.org/flags/52.png 94 94 FC Barcelona
## 2 https://cdn.sofifa.org/flags/38.png 94 94 Juventus
## 3 https://cdn.sofifa.org/flags/54.png 92 93 Paris Saint-Germain
## 4 https://cdn.sofifa.org/flags/45.png 91 93 Manchester United
## 5 https://cdn.sofifa.org/flags/7.png 91 92 Manchester City
## 6 https://cdn.sofifa.org/flags/7.png 91 91 Chelsea
## 7 https://cdn.sofifa.org/flags/10.png 91 91 Real Madrid
## 8 https://cdn.sofifa.org/flags/60.png 91 91 FC Barcelona
## 9 https://cdn.sofifa.org/flags/45.png 91 91 Real Madrid
## 10 https://cdn.sofifa.org/flags/44.png 90 93 Atlético Madrid
## Club.Logo Value Wage Special
## 1 https://cdn.sofifa.org/teams/2/light/241.png \200110.5M \200565K 2202
## 2 https://cdn.sofifa.org/teams/2/light/45.png \20077M \200405K 2228
## 3 https://cdn.sofifa.org/teams/2/light/73.png \200118.5M \200290K 2143
## 4 https://cdn.sofifa.org/teams/2/light/11.png \20072M \200260K 1471
## 5 https://cdn.sofifa.org/teams/2/light/10.png \200102M \200355K 2281
## 6 https://cdn.sofifa.org/teams/2/light/5.png \20093M \200340K 2142
## 7 https://cdn.sofifa.org/teams/2/light/243.png \20067M \200420K 2280
## 8 https://cdn.sofifa.org/teams/2/light/241.png \20080M \200455K 2346
## 9 https://cdn.sofifa.org/teams/2/light/243.png \20051M \200380K 2201
## 10 https://cdn.sofifa.org/teams/2/light/240.png \20068M \20094K 1331
## Preferred.Foot International.Reputation Weak.Foot Skill.Moves Work.Rate
## 1 Left 5 4 4 Medium/ Medium
## 2 Right 5 4 5 High/ Low
## 3 Right 5 5 5 High/ Medium
## 4 Right 4 3 1 Medium/ Medium
## 5 Right 4 5 4 High/ High
## 6 Right 4 4 4 High/ Medium
## 7 Right 4 4 4 High/ High
## 8 Right 5 4 3 High/ Medium
## 9 Right 4 3 3 High/ Medium
## 10 Right 3 3 1 Medium/ Medium
## Body.Type Real.Face Position Jersey.Number Joined Loaned.From
## 1 Messi Yes RF 10 Jul 1, 2004
## 2 C. Ronaldo Yes ST 7 Jul 10, 2018
## 3 Neymar Yes LW 10 Aug 3, 2017
## 4 Lean Yes GK 1 Jul 1, 2011
## 5 Normal Yes RCM 7 Aug 30, 2015
## 6 Normal Yes LF 10 Jul 1, 2012
## 7 Lean Yes RCM 10 Aug 1, 2012
## 8 Normal Yes RS 9 Jul 11, 2014
## 9 Normal Yes RCB 15 Aug 1, 2005
## 10 Normal Yes GK 1 Jul 16, 2014
## Contract.Valid.Until Height Weight LS ST RS LW LF CF RF RW
## 1 2021 5'7 159lbs 88+2 88+2 88+2 92+2 93+2 93+2 93+2 92+2
## 2 2022 6'2 183lbs 91+3 91+3 91+3 89+3 90+3 90+3 90+3 89+3
## 3 2022 5'9 150lbs 84+3 84+3 84+3 89+3 89+3 89+3 89+3 89+3
## 4 2020 6'4 168lbs
## 5 2023 5'11 154lbs 82+3 82+3 82+3 87+3 87+3 87+3 87+3 87+3
## 6 2020 5'8 163lbs 83+3 83+3 83+3 89+3 88+3 88+3 88+3 89+3
## 7 2020 5'8 146lbs 77+3 77+3 77+3 85+3 84+3 84+3 84+3 85+3
## 8 2021 6'0 190lbs 87+5 87+5 87+5 86+5 87+5 87+5 87+5 86+5
## 9 2020 6'0 181lbs 73+3 73+3 73+3 70+3 71+3 71+3 71+3 70+3
## 10 2021 6'2 192lbs
## LAM CAM RAM LM LCM CM RCM RM LWB LDM CDM RDM RWB LB LCB
## 1 93+2 93+2 93+2 91+2 84+2 84+2 84+2 91+2 64+2 61+2 61+2 61+2 64+2 59+2 47+2
## 2 88+3 88+3 88+3 88+3 81+3 81+3 81+3 88+3 65+3 61+3 61+3 61+3 65+3 61+3 53+3
## 3 89+3 89+3 89+3 88+3 81+3 81+3 81+3 88+3 65+3 60+3 60+3 60+3 65+3 60+3 47+3
## 4
## 5 88+3 88+3 88+3 88+3 87+3 87+3 87+3 88+3 77+3 77+3 77+3 77+3 77+3 73+3 66+3
## 6 89+3 89+3 89+3 89+3 82+3 82+3 82+3 89+3 66+3 63+3 63+3 63+3 66+3 60+3 49+3
## 7 87+3 87+3 87+3 86+3 88+3 88+3 88+3 86+3 82+3 81+3 81+3 81+3 82+3 79+3 71+3
## 8 85+5 85+5 85+5 84+5 79+5 79+5 79+5 84+5 69+5 68+5 68+5 68+5 69+5 66+5 63+5
## 9 71+3 71+3 71+3 72+3 75+3 75+3 75+3 72+3 81+3 84+3 84+3 84+3 81+3 84+3 87+3
## 10
## CB RCB RB Crossing Finishing HeadingAccuracy ShortPassing Volleys
## 1 47+2 47+2 59+2 84 95 70 90 86
## 2 53+3 53+3 61+3 84 94 89 81 87
## 3 47+3 47+3 60+3 79 87 62 84 84
## 4 17 13 21 50 13
## 5 66+3 66+3 73+3 93 82 55 92 82
## 6 49+3 49+3 60+3 81 84 61 89 80
## 7 71+3 71+3 79+3 86 72 55 93 76
## 8 63+5 63+5 66+5 77 93 77 82 88
## 9 87+3 87+3 84+3 66 60 91 78 66
## 10 13 11 15 29 13
## Dribbling Curve FKAccuracy LongPassing BallControl Acceleration SprintSpeed
## 1 97 93 94 87 96 91 86
## 2 88 81 76 77 94 89 91
## 3 96 88 87 78 95 94 90
## 4 18 21 19 51 42 57 58
## 5 86 85 83 91 91 78 76
## 6 95 83 79 83 94 94 88
## 7 90 85 78 88 93 80 72
## 8 87 86 84 64 90 86 75
## 9 63 74 72 77 84 76 75
## 10 12 13 14 26 16 43 60
## Agility Reactions Balance ShotPower Jumping Stamina Strength LongShots
## 1 91 95 95 85 68 72 59 94
## 2 87 96 70 95 95 88 79 93
## 3 96 94 84 80 61 81 49 82
## 4 60 90 43 31 67 43 64 12
## 5 79 91 77 91 63 90 75 91
## 6 95 90 94 82 56 83 66 80
## 7 93 90 94 79 68 89 58 82
## 8 82 92 83 86 69 90 83 85
## 9 78 85 66 79 93 84 83 59
## 10 67 86 49 22 76 41 78 12
## Aggression Interceptions Positioning Vision Penalties Composure Marking
## 1 48 22 94 94 75 96 33
## 2 63 29 95 82 85 95 28
## 3 56 36 89 87 81 94 27
## 4 38 30 12 68 40 68 15
## 5 76 61 87 94 79 88 68
## 6 54 41 87 89 86 91 34
## 7 62 83 79 92 82 84 60
## 8 87 41 92 84 85 85 62
## 9 88 90 60 63 75 82 87
## 10 34 19 11 70 11 70 27
## StandingTackle SlidingTackle GKDiving GKHandling GKKicking GKPositioning
## 1 28 26 6 11 15 14
## 2 31 23 7 11 15 14
## 3 24 33 9 9 15 15
## 4 21 13 90 85 87 88
## 5 58 51 15 13 5 10
## 6 27 22 11 12 6 8
## 7 76 73 13 9 7 14
## 8 45 38 27 25 31 33
## 9 92 91 11 8 9 7
## 10 12 18 86 92 78 88
## GKReflexes Release.Clause
## 1 8 \200226.5M
## 2 11 \200127.1M
## 3 11 \200228.1M
## 4 94 \200138.6M
## 5 13 \200196.4M
## 6 8 \200172.1M
## 7 9 \200137.4M
## 8 37 \200164M
## 9 11 \200104.6M
## 10 89 \200144.5M
tail(datos.fifa, 10)
## X.U.FEFF. ID Name Age
## 18198 18197 246167 D. Holland 18
## 18199 18198 242844 J. Livesey 18
## 18200 18199 244677 M. Baldisimo 18
## 18201 18200 231381 J. Young 18
## 18202 18201 243413 D. Walsh 18
## 18203 18202 238813 J. Lundstram 19
## 18204 18203 243165 N. Christoffersson 19
## 18205 18204 241638 B. Worman 16
## 18206 18205 246268 D. Walker-Rice 17
## 18207 18206 246269 G. Nugent 16
## Photo Nationality
## 18198 https://cdn.sofifa.org/players/4/19/246167.png Republic of Ireland
## 18199 https://cdn.sofifa.org/players/4/19/242844.png England
## 18200 https://cdn.sofifa.org/players/4/19/244677.png Canada
## 18201 https://cdn.sofifa.org/players/4/19/231381.png Scotland
## 18202 https://cdn.sofifa.org/players/4/19/243413.png Republic of Ireland
## 18203 https://cdn.sofifa.org/players/4/19/238813.png England
## 18204 https://cdn.sofifa.org/players/4/19/243165.png Sweden
## 18205 https://cdn.sofifa.org/players/4/19/241638.png England
## 18206 https://cdn.sofifa.org/players/4/19/246268.png England
## 18207 https://cdn.sofifa.org/players/4/19/246269.png England
## Flag Overall Potential
## 18198 https://cdn.sofifa.org/flags/25.png 47 61
## 18199 https://cdn.sofifa.org/flags/14.png 47 70
## 18200 https://cdn.sofifa.org/flags/70.png 47 69
## 18201 https://cdn.sofifa.org/flags/42.png 47 62
## 18202 https://cdn.sofifa.org/flags/25.png 47 68
## 18203 https://cdn.sofifa.org/flags/14.png 47 65
## 18204 https://cdn.sofifa.org/flags/46.png 47 63
## 18205 https://cdn.sofifa.org/flags/14.png 47 67
## 18206 https://cdn.sofifa.org/flags/14.png 47 66
## 18207 https://cdn.sofifa.org/flags/14.png 46 66
## Club Club.Logo
## 18198 Cork City https://cdn.sofifa.org/teams/2/light/422.png
## 18199 Burton Albion https://cdn.sofifa.org/teams/2/light/15015.png
## 18200 Vancouver Whitecaps FC https://cdn.sofifa.org/teams/2/light/101112.png
## 18201 Swindon Town https://cdn.sofifa.org/teams/2/light/1934.png
## 18202 Waterford FC https://cdn.sofifa.org/teams/2/light/753.png
## 18203 Crewe Alexandra https://cdn.sofifa.org/teams/2/light/121.png
## 18204 Trelleborgs FF https://cdn.sofifa.org/teams/2/light/703.png
## 18205 Cambridge United https://cdn.sofifa.org/teams/2/light/1944.png
## 18206 Tranmere Rovers https://cdn.sofifa.org/teams/2/light/15048.png
## 18207 Tranmere Rovers https://cdn.sofifa.org/teams/2/light/15048.png
## Value Wage Special Preferred.Foot International.Reputation Weak.Foot
## 18198 \20060K \2001K 1362 Right 1 3
## 18199 \20060K \2001K 792 Right 1 2
## 18200 \20070K \2001K 1303 Right 1 3
## 18201 \20060K \2001K 1203 Left 1 2
## 18202 \20060K \2001K 1098 Left 1 3
## 18203 \20060K \2001K 1307 Right 1 2
## 18204 \20060K \2001K 1098 Right 1 2
## 18205 \20060K \2001K 1189 Right 1 3
## 18206 \20060K \2001K 1228 Right 1 3
## 18207 \20060K \2001K 1321 Right 1 3
## Skill.Moves Work.Rate Body.Type Real.Face Position Jersey.Number
## 18198 2 Medium/ Medium Normal No CM 14
## 18199 1 Medium/ Medium Lean No GK 22
## 18200 2 Medium/ High Lean No CM 65
## 18201 2 Medium/ Medium Lean No ST 21
## 18202 2 Medium/ Medium Lean No RB 29
## 18203 2 Medium/ Medium Lean No CM 22
## 18204 2 Medium/ Medium Normal No ST 21
## 18205 2 Medium/ Medium Normal No ST 33
## 18206 2 Medium/ Medium Lean No RW 34
## 18207 2 Medium/ Medium Lean No CM 33
## Joined Loaned.From Contract.Valid.Until Height Weight LS ST
## 18198 Oct 5, 2018 2018 5'10 141lbs 45+2 45+2
## 18199 Nov 10, 2018 2021 5'11 154lbs
## 18200 Jul 17, 2018 2021 5'6 150lbs 42+2 42+2
## 18201 Oct 17, 2015 2019 5'9 157lbs 45+2 45+2
## 18202 Apr 20, 2018 2018 6'1 168lbs 32+2 32+2
## 18203 May 3, 2017 2019 5'9 134lbs 42+2 42+2
## 18204 Mar 19, 2018 2020 6'3 170lbs 45+2 45+2
## 18205 Jul 1, 2017 2021 5'8 148lbs 45+2 45+2
## 18206 Apr 24, 2018 2019 5'10 154lbs 47+2 47+2
## 18207 Oct 30, 2018 2019 5'10 176lbs 43+2 43+2
## RS LW LF CF RF RW LAM CAM RAM LM LCM CM RCM RM
## 18198 45+2 49+2 48+2 48+2 48+2 49+2 49+2 49+2 49+2 49+2 47+2 47+2 47+2 49+2
## 18199
## 18200 42+2 43+2 44+2 44+2 44+2 43+2 44+2 44+2 44+2 45+2 45+2 45+2 45+2 45+2
## 18201 45+2 44+2 45+2 45+2 45+2 44+2 44+2 44+2 44+2 41+2 37+2 37+2 37+2 41+2
## 18202 32+2 29+2 30+2 30+2 30+2 29+2 28+2 28+2 28+2 30+2 30+2 30+2 30+2 30+2
## 18203 42+2 44+2 44+2 44+2 44+2 44+2 45+2 45+2 45+2 44+2 45+2 45+2 45+2 44+2
## 18204 45+2 39+2 42+2 42+2 42+2 39+2 40+2 40+2 40+2 38+2 35+2 35+2 35+2 38+2
## 18205 45+2 45+2 46+2 46+2 46+2 45+2 44+2 44+2 44+2 44+2 38+2 38+2 38+2 44+2
## 18206 47+2 47+2 46+2 46+2 46+2 47+2 45+2 45+2 45+2 46+2 39+2 39+2 39+2 46+2
## 18207 43+2 45+2 44+2 44+2 44+2 45+2 45+2 45+2 45+2 46+2 45+2 45+2 45+2 46+2
## LWB LDM CDM RDM RWB LB LCB CB RCB RB Crossing Finishing
## 18198 45+2 44+2 44+2 44+2 45+2 44+2 40+2 40+2 40+2 44+2 44 44
## 18199 14 8
## 18200 47+2 48+2 48+2 48+2 47+2 47+2 48+2 48+2 48+2 47+2 31 31
## 18201 31+2 28+2 28+2 28+2 31+2 30+2 27+2 27+2 27+2 30+2 28 47
## 18202 39+2 38+2 38+2 38+2 39+2 42+2 46+2 46+2 46+2 42+2 22 23
## 18203 44+2 45+2 45+2 45+2 44+2 45+2 45+2 45+2 45+2 45+2 34 38
## 18204 30+2 31+2 31+2 31+2 30+2 29+2 32+2 32+2 32+2 29+2 23 52
## 18205 34+2 30+2 30+2 30+2 34+2 33+2 28+2 28+2 28+2 33+2 25 40
## 18206 36+2 32+2 32+2 32+2 36+2 35+2 31+2 31+2 31+2 35+2 44 50
## 18207 46+2 46+2 46+2 46+2 46+2 46+2 47+2 47+2 47+2 46+2 41 34
## HeadingAccuracy ShortPassing Volleys Dribbling Curve FKAccuracy
## 18198 36 53 43 50 48 46
## 18199 14 19 8 10 13 10
## 18200 41 51 26 46 35 31
## 18201 47 42 37 39 32 25
## 18202 45 25 27 21 21 27
## 18203 40 49 25 42 30 34
## 18204 52 43 36 39 32 20
## 18205 46 38 38 45 38 27
## 18206 39 42 40 51 34 32
## 18207 46 48 30 43 40 34
## LongPassing BallControl Acceleration SprintSpeed Agility Reactions
## 18198 52 51 68 62 58 41
## 18199 21 11 18 24 22 36
## 18200 55 47 60 63 53 46
## 18201 30 41 65 48 64 54
## 18202 27 32 52 52 39 43
## 18203 45 43 54 57 60 49
## 18204 25 40 41 39 38 40
## 18205 28 44 70 69 50 47
## 18206 32 52 61 60 52 21
## 18207 44 51 57 55 55 51
## Balance ShotPower Jumping Stamina Strength LongShots Aggression
## 18198 62 50 55 50 38 37 37
## 18199 47 26 56 20 38 5 25
## 18200 55 49 57 42 43 30 53
## 18201 80 44 77 31 31 51 26
## 18202 48 39 74 39 52 16 44
## 18203 76 43 55 40 47 38 46
## 18204 52 41 47 43 67 42 47
## 18205 58 45 60 55 32 45 32
## 18206 71 64 42 40 48 34 33
## 18207 63 43 62 47 60 32 56
## Interceptions Positioning Vision Penalties Composure Marking
## 18198 28 39 48 49 52 41
## 18199 6 5 37 14 34 15
## 18200 49 35 40 36 40 48
## 18201 16 46 37 58 50 15
## 18202 45 20 31 38 43 44
## 18203 46 39 52 43 45 40
## 18204 16 46 33 43 42 22
## 18205 15 48 43 55 41 32
## 18206 22 44 47 50 46 20
## 18207 42 34 49 33 43 40
## StandingTackle SlidingTackle GKDiving GKHandling GKKicking GKPositioning
## 18198 47 38 13 6 9 10
## 18199 11 13 46 52 58 42
## 18200 49 49 7 7 9 14
## 18201 17 14 11 15 12 12
## 18202 47 53 9 10 9 11
## 18203 48 47 10 13 7 8
## 18204 15 19 10 9 9 5
## 18205 13 11 6 5 10 6
## 18206 25 27 14 6 14 8
## 18207 43 50 10 15 9 12
## GKReflexes Release.Clause
## 18198 15 \20088K
## 18199 48 \200165K
## 18200 15 \200175K
## 18201 11 \200143K
## 18202 13 \200153K
## 18203 9 \200143K
## 18204 12 \200113K
## 18205 13 \200165K
## 18206 9 \200143K
## 18207 9 \200165K
summary(datos.fifa)
## X.U.FEFF. ID Name Age
## Min. : 0 Min. : 16 Length:18207 Min. :16.00
## 1st Qu.: 4552 1st Qu.:200316 Class :character 1st Qu.:21.00
## Median : 9103 Median :221759 Mode :character Median :25.00
## Mean : 9103 Mean :214298 Mean :25.12
## 3rd Qu.:13654 3rd Qu.:236530 3rd Qu.:28.00
## Max. :18206 Max. :246620 Max. :45.00
##
## Photo Nationality Flag Overall
## Length:18207 Length:18207 Length:18207 Min. :46.00
## Class :character Class :character Class :character 1st Qu.:62.00
## Mode :character Mode :character Mode :character Median :66.00
## Mean :66.24
## 3rd Qu.:71.00
## Max. :94.00
##
## Potential Club Club.Logo Value
## Min. :48.00 Length:18207 Length:18207 Length:18207
## 1st Qu.:67.00 Class :character Class :character Class :character
## Median :71.00 Mode :character Mode :character Mode :character
## Mean :71.31
## 3rd Qu.:75.00
## Max. :95.00
##
## Wage Special Preferred.Foot International.Reputation
## Length:18207 Min. : 731 Length:18207 Min. :1.000
## Class :character 1st Qu.:1457 Class :character 1st Qu.:1.000
## Mode :character Median :1635 Mode :character Median :1.000
## Mean :1598 Mean :1.113
## 3rd Qu.:1787 3rd Qu.:1.000
## Max. :2346 Max. :5.000
## NA's :48
## Weak.Foot Skill.Moves Work.Rate Body.Type
## Min. :1.000 Min. :1.000 Length:18207 Length:18207
## 1st Qu.:3.000 1st Qu.:2.000 Class :character Class :character
## Median :3.000 Median :2.000 Mode :character Mode :character
## Mean :2.947 Mean :2.361
## 3rd Qu.:3.000 3rd Qu.:3.000
## Max. :5.000 Max. :5.000
## NA's :48 NA's :48
## Real.Face Position Jersey.Number Joined
## Length:18207 Length:18207 Min. : 1.00 Length:18207
## Class :character Class :character 1st Qu.: 8.00 Class :character
## Mode :character Mode :character Median :17.00 Mode :character
## Mean :19.55
## 3rd Qu.:26.00
## Max. :99.00
## NA's :60
## Loaned.From Contract.Valid.Until Height Weight
## Length:18207 Length:18207 Length:18207 Length:18207
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## LS ST RS LW
## Length:18207 Length:18207 Length:18207 Length:18207
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## LF CF RF RW
## Length:18207 Length:18207 Length:18207 Length:18207
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## LAM CAM RAM LM
## Length:18207 Length:18207 Length:18207 Length:18207
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## LCM CM RCM RM
## Length:18207 Length:18207 Length:18207 Length:18207
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## LWB LDM CDM RDM
## Length:18207 Length:18207 Length:18207 Length:18207
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## RWB LB LCB CB
## Length:18207 Length:18207 Length:18207 Length:18207
## Class :character Class :character Class :character Class :character
## Mode :character Mode :character Mode :character Mode :character
##
##
##
##
## RCB RB Crossing Finishing
## Length:18207 Length:18207 Min. : 5.00 Min. : 2.00
## Class :character Class :character 1st Qu.:38.00 1st Qu.:30.00
## Mode :character Mode :character Median :54.00 Median :49.00
## Mean :49.73 Mean :45.55
## 3rd Qu.:64.00 3rd Qu.:62.00
## Max. :93.00 Max. :95.00
## NA's :48 NA's :48
## HeadingAccuracy ShortPassing Volleys Dribbling
## Min. : 4.0 Min. : 7.00 Min. : 4.00 Min. : 4.00
## 1st Qu.:44.0 1st Qu.:54.00 1st Qu.:30.00 1st Qu.:49.00
## Median :56.0 Median :62.00 Median :44.00 Median :61.00
## Mean :52.3 Mean :58.69 Mean :42.91 Mean :55.37
## 3rd Qu.:64.0 3rd Qu.:68.00 3rd Qu.:57.00 3rd Qu.:68.00
## Max. :94.0 Max. :93.00 Max. :90.00 Max. :97.00
## NA's :48 NA's :48 NA's :48 NA's :48
## Curve FKAccuracy LongPassing BallControl
## Min. : 6.00 Min. : 3.00 Min. : 9.00 Min. : 5.00
## 1st Qu.:34.00 1st Qu.:31.00 1st Qu.:43.00 1st Qu.:54.00
## Median :48.00 Median :41.00 Median :56.00 Median :63.00
## Mean :47.17 Mean :42.86 Mean :52.71 Mean :58.37
## 3rd Qu.:62.00 3rd Qu.:57.00 3rd Qu.:64.00 3rd Qu.:69.00
## Max. :94.00 Max. :94.00 Max. :93.00 Max. :96.00
## NA's :48 NA's :48 NA's :48 NA's :48
## Acceleration SprintSpeed Agility Reactions Balance
## Min. :12.00 Min. :12.00 Min. :14.0 Min. :21.00 Min. :16.00
## 1st Qu.:57.00 1st Qu.:57.00 1st Qu.:55.0 1st Qu.:56.00 1st Qu.:56.00
## Median :67.00 Median :67.00 Median :66.0 Median :62.00 Median :66.00
## Mean :64.61 Mean :64.73 Mean :63.5 Mean :61.84 Mean :63.97
## 3rd Qu.:75.00 3rd Qu.:75.00 3rd Qu.:74.0 3rd Qu.:68.00 3rd Qu.:74.00
## Max. :97.00 Max. :96.00 Max. :96.0 Max. :96.00 Max. :96.00
## NA's :48 NA's :48 NA's :48 NA's :48 NA's :48
## ShotPower Jumping Stamina Strength
## Min. : 2.00 Min. :15.00 Min. :12.00 Min. :17.00
## 1st Qu.:45.00 1st Qu.:58.00 1st Qu.:56.00 1st Qu.:58.00
## Median :59.00 Median :66.00 Median :66.00 Median :67.00
## Mean :55.46 Mean :65.09 Mean :63.22 Mean :65.31
## 3rd Qu.:68.00 3rd Qu.:73.00 3rd Qu.:74.00 3rd Qu.:74.00
## Max. :95.00 Max. :95.00 Max. :96.00 Max. :97.00
## NA's :48 NA's :48 NA's :48 NA's :48
## LongShots Aggression Interceptions Positioning Vision
## Min. : 3.00 Min. :11.00 Min. : 3.0 Min. : 2.00 Min. :10.0
## 1st Qu.:33.00 1st Qu.:44.00 1st Qu.:26.0 1st Qu.:38.00 1st Qu.:44.0
## Median :51.00 Median :59.00 Median :52.0 Median :55.00 Median :55.0
## Mean :47.11 Mean :55.87 Mean :46.7 Mean :49.96 Mean :53.4
## 3rd Qu.:62.00 3rd Qu.:69.00 3rd Qu.:64.0 3rd Qu.:64.00 3rd Qu.:64.0
## Max. :94.00 Max. :95.00 Max. :92.0 Max. :95.00 Max. :94.0
## NA's :48 NA's :48 NA's :48 NA's :48 NA's :48
## Penalties Composure Marking StandingTackle SlidingTackle
## Min. : 5.00 Min. : 3.00 Min. : 3.00 Min. : 2.0 Min. : 3.00
## 1st Qu.:39.00 1st Qu.:51.00 1st Qu.:30.00 1st Qu.:27.0 1st Qu.:24.00
## Median :49.00 Median :60.00 Median :53.00 Median :55.0 Median :52.00
## Mean :48.55 Mean :58.65 Mean :47.28 Mean :47.7 Mean :45.66
## 3rd Qu.:60.00 3rd Qu.:67.00 3rd Qu.:64.00 3rd Qu.:66.0 3rd Qu.:64.00
## Max. :92.00 Max. :96.00 Max. :94.00 Max. :93.0 Max. :91.00
## NA's :48 NA's :48 NA's :48 NA's :48 NA's :48
## GKDiving GKHandling GKKicking GKPositioning
## Min. : 1.00 Min. : 1.00 Min. : 1.00 Min. : 1.00
## 1st Qu.: 8.00 1st Qu.: 8.00 1st Qu.: 8.00 1st Qu.: 8.00
## Median :11.00 Median :11.00 Median :11.00 Median :11.00
## Mean :16.62 Mean :16.39 Mean :16.23 Mean :16.39
## 3rd Qu.:14.00 3rd Qu.:14.00 3rd Qu.:14.00 3rd Qu.:14.00
## Max. :90.00 Max. :92.00 Max. :91.00 Max. :90.00
## NA's :48 NA's :48 NA's :48 NA's :48
## GKReflexes Release.Clause
## Min. : 1.00 Length:18207
## 1st Qu.: 8.00 Class :character
## Median :11.00 Mode :character
## Mean :16.71
## 3rd Qu.:14.00
## Max. :94.00
## NA's :48
str(datos.fifa)
## 'data.frame': 18207 obs. of 89 variables:
## $ X.U.FEFF. : int 0 1 2 3 4 5 6 7 8 9 ...
## $ ID : int 158023 20801 190871 193080 192985 183277 177003 176580 155862 200389 ...
## $ Name : chr "L. Messi" "Cristiano Ronaldo" "Neymar Jr" "De Gea" ...
## $ Age : int 31 33 26 27 27 27 32 31 32 25 ...
## $ Photo : chr "https://cdn.sofifa.org/players/4/19/158023.png" "https://cdn.sofifa.org/players/4/19/20801.png" "https://cdn.sofifa.org/players/4/19/190871.png" "https://cdn.sofifa.org/players/4/19/193080.png" ...
## $ Nationality : chr "Argentina" "Portugal" "Brazil" "Spain" ...
## $ Flag : chr "https://cdn.sofifa.org/flags/52.png" "https://cdn.sofifa.org/flags/38.png" "https://cdn.sofifa.org/flags/54.png" "https://cdn.sofifa.org/flags/45.png" ...
## $ Overall : int 94 94 92 91 91 91 91 91 91 90 ...
## $ Potential : int 94 94 93 93 92 91 91 91 91 93 ...
## $ Club : chr "FC Barcelona" "Juventus" "Paris Saint-Germain" "Manchester United" ...
## $ Club.Logo : chr "https://cdn.sofifa.org/teams/2/light/241.png" "https://cdn.sofifa.org/teams/2/light/45.png" "https://cdn.sofifa.org/teams/2/light/73.png" "https://cdn.sofifa.org/teams/2/light/11.png" ...
## $ Value : chr "\200110.5M" "\20077M" "\200118.5M" "\20072M" ...
## $ Wage : chr "\200565K" "\200405K" "\200290K" "\200260K" ...
## $ Special : int 2202 2228 2143 1471 2281 2142 2280 2346 2201 1331 ...
## $ Preferred.Foot : chr "Left" "Right" "Right" "Right" ...
## $ International.Reputation: int 5 5 5 4 4 4 4 5 4 3 ...
## $ Weak.Foot : int 4 4 5 3 5 4 4 4 3 3 ...
## $ Skill.Moves : int 4 5 5 1 4 4 4 3 3 1 ...
## $ Work.Rate : chr "Medium/ Medium" "High/ Low" "High/ Medium" "Medium/ Medium" ...
## $ Body.Type : chr "Messi" "C. Ronaldo" "Neymar" "Lean" ...
## $ Real.Face : chr "Yes" "Yes" "Yes" "Yes" ...
## $ Position : chr "RF" "ST" "LW" "GK" ...
## $ Jersey.Number : int 10 7 10 1 7 10 10 9 15 1 ...
## $ Joined : chr "Jul 1, 2004" "Jul 10, 2018" "Aug 3, 2017" "Jul 1, 2011" ...
## $ Loaned.From : chr "" "" "" "" ...
## $ Contract.Valid.Until : chr "2021" "2022" "2022" "2020" ...
## $ Height : chr "5'7" "6'2" "5'9" "6'4" ...
## $ Weight : chr "159lbs" "183lbs" "150lbs" "168lbs" ...
## $ LS : chr "88+2" "91+3" "84+3" "" ...
## $ ST : chr "88+2" "91+3" "84+3" "" ...
## $ RS : chr "88+2" "91+3" "84+3" "" ...
## $ LW : chr "92+2" "89+3" "89+3" "" ...
## $ LF : chr "93+2" "90+3" "89+3" "" ...
## $ CF : chr "93+2" "90+3" "89+3" "" ...
## $ RF : chr "93+2" "90+3" "89+3" "" ...
## $ RW : chr "92+2" "89+3" "89+3" "" ...
## $ LAM : chr "93+2" "88+3" "89+3" "" ...
## $ CAM : chr "93+2" "88+3" "89+3" "" ...
## $ RAM : chr "93+2" "88+3" "89+3" "" ...
## $ LM : chr "91+2" "88+3" "88+3" "" ...
## $ LCM : chr "84+2" "81+3" "81+3" "" ...
## $ CM : chr "84+2" "81+3" "81+3" "" ...
## $ RCM : chr "84+2" "81+3" "81+3" "" ...
## $ RM : chr "91+2" "88+3" "88+3" "" ...
## $ LWB : chr "64+2" "65+3" "65+3" "" ...
## $ LDM : chr "61+2" "61+3" "60+3" "" ...
## $ CDM : chr "61+2" "61+3" "60+3" "" ...
## $ RDM : chr "61+2" "61+3" "60+3" "" ...
## $ RWB : chr "64+2" "65+3" "65+3" "" ...
## $ LB : chr "59+2" "61+3" "60+3" "" ...
## $ LCB : chr "47+2" "53+3" "47+3" "" ...
## $ CB : chr "47+2" "53+3" "47+3" "" ...
## $ RCB : chr "47+2" "53+3" "47+3" "" ...
## $ RB : chr "59+2" "61+3" "60+3" "" ...
## $ Crossing : int 84 84 79 17 93 81 86 77 66 13 ...
## $ Finishing : int 95 94 87 13 82 84 72 93 60 11 ...
## $ HeadingAccuracy : int 70 89 62 21 55 61 55 77 91 15 ...
## $ ShortPassing : int 90 81 84 50 92 89 93 82 78 29 ...
## $ Volleys : int 86 87 84 13 82 80 76 88 66 13 ...
## $ Dribbling : int 97 88 96 18 86 95 90 87 63 12 ...
## $ Curve : int 93 81 88 21 85 83 85 86 74 13 ...
## $ FKAccuracy : int 94 76 87 19 83 79 78 84 72 14 ...
## $ LongPassing : int 87 77 78 51 91 83 88 64 77 26 ...
## $ BallControl : int 96 94 95 42 91 94 93 90 84 16 ...
## $ Acceleration : int 91 89 94 57 78 94 80 86 76 43 ...
## $ SprintSpeed : int 86 91 90 58 76 88 72 75 75 60 ...
## $ Agility : int 91 87 96 60 79 95 93 82 78 67 ...
## $ Reactions : int 95 96 94 90 91 90 90 92 85 86 ...
## $ Balance : int 95 70 84 43 77 94 94 83 66 49 ...
## $ ShotPower : int 85 95 80 31 91 82 79 86 79 22 ...
## $ Jumping : int 68 95 61 67 63 56 68 69 93 76 ...
## $ Stamina : int 72 88 81 43 90 83 89 90 84 41 ...
## $ Strength : int 59 79 49 64 75 66 58 83 83 78 ...
## $ LongShots : int 94 93 82 12 91 80 82 85 59 12 ...
## $ Aggression : int 48 63 56 38 76 54 62 87 88 34 ...
## $ Interceptions : int 22 29 36 30 61 41 83 41 90 19 ...
## $ Positioning : int 94 95 89 12 87 87 79 92 60 11 ...
## $ Vision : int 94 82 87 68 94 89 92 84 63 70 ...
## $ Penalties : int 75 85 81 40 79 86 82 85 75 11 ...
## $ Composure : int 96 95 94 68 88 91 84 85 82 70 ...
## $ Marking : int 33 28 27 15 68 34 60 62 87 27 ...
## $ StandingTackle : int 28 31 24 21 58 27 76 45 92 12 ...
## $ SlidingTackle : int 26 23 33 13 51 22 73 38 91 18 ...
## $ GKDiving : int 6 7 9 90 15 11 13 27 11 86 ...
## $ GKHandling : int 11 11 9 85 13 12 9 25 8 92 ...
## $ GKKicking : int 15 15 15 87 5 6 7 31 9 78 ...
## $ GKPositioning : int 14 14 15 88 10 8 14 33 7 88 ...
## $ GKReflexes : int 8 11 11 94 13 8 9 37 11 89 ...
## $ Release.Clause : chr "\200226.5M" "\200127.1M" "\200228.1M" "\200138.6M" ...
Un proceso de limpieza de datos no sólo es encontrar basura como NA o valores vacíos null y saber que hacer con ellos, en muchos casos se requiere transformar variables, eliminar datos y agregar variables para dejar listos para realiar análisis de datos posteriores.
Agregar Pais de club dependiendo del pais de donse sea el club.
Agregar Region de club: [“AFRICA”,“ASIA”,“OCEANIA”, “CONCACAF”, “EUROPA”,“SUDAMERICA”]
Agregar variable estatura en metros numérica de Heigth
Agregar variable peso en kgs numérica de la variable Weight
Generar un conjunto de datos mas manipulable para resolver el análisis del CASO.
Cargar las funciones requeridas
source("../Funciones/misfunciones.r")
datos.fifa <- mutate(datos.fifa, Estatura = festatura(Height), Pesokgs = flbskgs(Weight))
datos.fifa.reduc <- select(datos.fifa, Name, Age, Nationality, Overall, Potential, Club, Value, Preferred.Foot, Position, Height, Weight, Estatura, Pesokgs)
head(datos.fifa.reduc)
## Name Age Nationality Overall Potential Club
## 1 L. Messi 31 Argentina 94 94 FC Barcelona
## 2 Cristiano Ronaldo 33 Portugal 94 94 Juventus
## 3 Neymar Jr 26 Brazil 92 93 Paris Saint-Germain
## 4 De Gea 27 Spain 91 93 Manchester United
## 5 K. De Bruyne 27 Belgium 91 92 Manchester City
## 6 E. Hazard 27 Belgium 91 91 Chelsea
## Value Preferred.Foot Position Height Weight Estatura Pesokgs
## 1 \200110.5M Left RF 5'7 159lbs 1.70 72.12
## 2 \20077M Right ST 6'2 183lbs 1.88 83.01
## 3 \200118.5M Right LW 5'9 150lbs 1.75 68.04
## 4 \20072M Right GK 6'4 168lbs 1.93 76.20
## 5 \200102M Right RCM 5'11 154lbs 1.80 69.85
## 6 \20093M Right LF 5'8 163lbs 1.73 73.94
cat("Número de registros ",nrow(datos.fifa.reduc))
## Número de registros 18207
cat("Número de variables ",ncol(datos.fifa.reduc))
## Número de variables 13
summary(datos.fifa.reduc)
## Name Age Nationality Overall
## Length:18207 Min. :16.00 Length:18207 Min. :46.00
## Class :character 1st Qu.:21.00 Class :character 1st Qu.:62.00
## Mode :character Median :25.00 Mode :character Median :66.00
## Mean :25.12 Mean :66.24
## 3rd Qu.:28.00 3rd Qu.:71.00
## Max. :45.00 Max. :94.00
##
## Potential Club Value Preferred.Foot
## Min. :48.00 Length:18207 Length:18207 Length:18207
## 1st Qu.:67.00 Class :character Class :character Class :character
## Median :71.00 Mode :character Mode :character Mode :character
## Mean :71.31
## 3rd Qu.:75.00
## Max. :95.00
##
## Position Height Weight Estatura
## Length:18207 Length:18207 Length:18207 Min. :1.550
## Class :character Class :character Class :character 1st Qu.:1.750
## Mode :character Mode :character Mode :character Median :1.800
## Mean :1.812
## 3rd Qu.:1.850
## Max. :2.060
## NA's :48
## Pesokgs
## Min. : 49.90
## 1st Qu.: 69.85
## Median : 74.84
## Mean : 75.29
## 3rd Qu.: 79.83
## Max. :110.22
## NA's :48
str(datos.fifa.reduc)
## 'data.frame': 18207 obs. of 13 variables:
## $ Name : chr "L. Messi" "Cristiano Ronaldo" "Neymar Jr" "De Gea" ...
## $ Age : int 31 33 26 27 27 27 32 31 32 25 ...
## $ Nationality : chr "Argentina" "Portugal" "Brazil" "Spain" ...
## $ Overall : int 94 94 92 91 91 91 91 91 91 90 ...
## $ Potential : int 94 94 93 93 92 91 91 91 91 93 ...
## $ Club : chr "FC Barcelona" "Juventus" "Paris Saint-Germain" "Manchester United" ...
## $ Value : chr "\200110.5M" "\20077M" "\200118.5M" "\20072M" ...
## $ Preferred.Foot: chr "Left" "Right" "Right" "Right" ...
## $ Position : chr "RF" "ST" "LW" "GK" ...
## $ Height : chr "5'7" "6'2" "5'9" "6'4" ...
## $ Weight : chr "159lbs" "183lbs" "150lbs" "168lbs" ...
## $ Estatura : num 1.7 1.88 1.75 1.93 1.8 1.73 1.73 1.83 1.83 1.88 ...
## $ Pesokgs : num 72.1 83 68 76.2 69.8 ...
nacion <- datos.fifa.reduc %>%
group_by (Nationality) %>%
summarise(n = n())
nacion <- arrange(nacion, desc(n))
head(nacion, 10)
## # A tibble: 10 x 2
## Nationality n
## <chr> <int>
## 1 England 1662
## 2 Germany 1198
## 3 Spain 1072
## 4 Argentina 937
## 5 France 914
## 6 Brazil 827
## 7 Italy 702
## 8 Colombia 618
## 9 Japan 478
## 10 Netherlands 453
tail(nacion, 10)
## # A tibble: 10 x 2
## Nationality n
## <chr> <int>
## 1 New Caledonia 1
## 2 Oman 1
## 3 Palestine 1
## 4 Puerto Rico 1
## 5 Qatar 1
## 6 Rwanda 1
## 7 São Tomé & Príncipe 1
## 8 South Sudan 1
## 9 St Lucia 1
## 10 United Arab Emirates 1
ggplot(data = head(nacion, 10), aes(x = Nationality, y = n, color=Nationality)) +
geom_bar(stat = "identity")
ggplot(data = tail(nacion, 10), aes(x = Nationality, y = n, color=Nationality)) +
geom_bar(stat = "identity")
age.nacion <- datos.fifa.reduc %>%
group_by (Nationality) %>%
summarise(n = n(), media = round(mean(Age),2), mediana = round(median(Age),2))
age.club <- datos.fifa.reduc %>%
group_by (Club) %>%
summarise(n = n(), media = round(mean(Age),2), mediana = round(median(Age),2))
age.nacion <- arrange(age.nacion, media)
age.club <- arrange(age.club, media)
head(age.nacion, 10)
## # A tibble: 10 x 4
## Nationality n media mediana
## <chr> <int> <dbl> <dbl>
## 1 Indonesia 1 17 17
## 2 Botswana 1 20 20
## 3 Rwanda 1 21 21
## 4 Tanzania 3 22 22
## 5 Zambia 9 22.2 21
## 6 Afghanistan 4 22.5 22
## 7 Chad 2 22.5 22.5
## 8 Antigua & Barbuda 4 22.8 22
## 9 Dominican Republic 2 23 23
## 10 Jordan 1 23 23
tail(age.nacion, 10)
## # A tibble: 10 x 4
## Nationality n media mediana
## <chr> <int> <dbl> <dbl>
## 1 Fiji 1 30 30
## 2 Guam 1 30 30
## 3 New Caledonia 1 30 30
## 4 Kuwait 1 31 31
## 5 Palestine 1 31 31
## 6 São Tomé & Príncipe 1 31 31
## 7 Trinidad & Tobago 4 31.8 28.5
## 8 Ethiopia 1 32 32
## 9 Puerto Rico 1 34 34
## 10 Oman 1 36 36
head(age.club, 10)
## # A tibble: 10 x 4
## Club n media mediana
## <chr> <int> <dbl> <dbl>
## 1 FC Nordsjælland 27 20.3 19
## 2 FC Groningen 26 21.4 20
## 3 Bohemian FC 25 21.5 20
## 4 FC Sochaux-Montbéliard 28 21.7 21
## 5 FC Admira Wacker Mödling 27 21.9 22
## 6 LOSC Lille 25 22 21
## 7 Envigado FC 28 22.0 21
## 8 Stabæk Fotball 27 22.1 21
## 9 Barnsley 28 22.1 23
## 10 Derry City 18 22.1 20.5
tail(age.club, 10)
## # A tibble: 10 x 4
## Club n media mediana
## <chr> <int> <dbl> <dbl>
## 1 Grêmio 20 30 30
## 2 Vitória 20 30 30
## 3 Ceará Sporting Club 20 30.2 30
## 4 Fluminense 20 30.2 30
## 5 Sport Club do Recife 20 30.2 30
## 6 Atlético Paranaense 20 30.4 30
## 7 Botafogo 20 30.4 32
## 8 Chapecoense 20 30.4 30
## 9 Cruzeiro 20 30.6 30
## 10 Paraná 20 31.6 34
la.media <- round(mean(age.nacion$n),0)
la.media
## [1] 111
age.nacion.mean.n <- filter(age.nacion, n >= la.media)
age.nacion.mean.n <- arrange(age.nacion.mean.n, media)
head(age.nacion.mean.n, 10)
## # A tibble: 10 x 4
## Nationality n media mediana
## <chr> <int> <dbl> <dbl>
## 1 Nigeria 121 23.1 22
## 2 Ghana 114 23.7 23
## 3 Netherlands 453 24 24
## 4 England 1662 24.0 23
## 5 Norway 341 24.0 24
## 6 Denmark 336 24.2 24
## 7 Mexico 366 24.3 23
## 8 Belgium 260 24.3 23
## 9 Germany 1198 24.3 24
## 10 Australia 236 24.4 24
tail(age.nacion.mean.n, 10)
## # A tibble: 10 x 4
## Nationality n media mediana
## <chr> <int> <dbl> <dbl>
## 1 Senegal 130 25.4 25.5
## 2 Serbia 126 25.6 26
## 3 Portugal 322 25.8 25
## 4 Italy 702 25.9 26
## 5 China PR 392 26.1 26
## 6 Japan 478 26.2 26
## 7 Argentina 937 26.2 26
## 8 Korea Republic 335 26.4 26
## 9 Uruguay 149 26.6 26
## 10 Brazil 827 27.6 27
ggplot(data = head(age.nacion.mean.n, 10), aes(Nationality, media)) +
geom_boxplot()
ggplot(data = tail(age.nacion.mean.n, 10), aes(Nationality, media)) +
geom_boxplot()
* Unicamente con los paises Top
paises.top <- head(age.nacion.mean.n$Nationality, 10)
paises.top
## [1] "Nigeria" "Ghana" "Netherlands" "England" "Norway"
## [6] "Denmark" "Mexico" "Belgium" "Germany" "Australia"
datos.fifa.paises.top.mean.n <- filter(datos.fifa, Nationality %in% paises.top)
head(datos.fifa.paises.top.mean.n[,c(3,4,6)])
## Name Age Nationality
## 1 K. De Bruyne 27 Belgium
## 2 E. Hazard 27 Belgium
## 3 T. Kroos 28 Germany
## 4 H. Kane 24 England
## 5 M. ter Stegen 26 Germany
## 6 T. Courtois 26 Belgium
ggplot(data = datos.fifa.paises.top.mean.n, aes(x = Nationality, y = Age, color = Nationality)) +
geom_boxplot()
datos.fifa.reduc.merge <- merge(x = datos.fifa.reduc, y=clubs.nation,
by.x = 'Club', by.y = 'club')
head(arrange(datos.fifa.reduc.merge, desc(country)), 10)
## Club Name Age Nationality Overall Potential
## 1 Atlanta United M. Ambrose 24 United States 63 67
## 2 Atlanta United L. Kunga 19 United States 57 73
## 3 Atlanta United C. McCann 30 Republic of Ireland 66 66
## 4 Atlanta United F. Escobar 23 Argentina 67 74
## 5 Atlanta United A. Wheeler-Omiunu 23 United States 58 64
## 6 Atlanta United K. Kratz 31 Germany 67 67
## 7 Atlanta United E. Remedi 23 Argentina 71 79
## 8 Atlanta United J. Larentowicz 34 United States 68 68
## 9 Atlanta United J. Hernández 21 Venezuela 62 71
## 10 Atlanta United M. Robinson 21 United States 61 72
## Value Preferred.Foot Position Height Weight Estatura Pesokgs country
## 1 \200400K Left LB 5'9 165lbs 1.75 74.84 USA
## 2 \200220K Left LM 5'8 150lbs 1.73 68.04 USA
## 3 \200475K Left LB 6'1 165lbs 1.85 74.84 USA
## 4 \200900K Right RB 6'0 165lbs 1.83 74.84 USA
## 5 \200170K Right CM 5'9 174lbs 1.75 78.93 USA
## 6 \200675K Right CAM 5'8 159lbs 1.73 72.12 USA
## 7 \2003M Right LDM 5'7 159lbs 1.70 72.12 USA
## 8 \200270K Right CDM 6'1 174lbs 1.85 78.93 USA
## 9 \200400K Left LB 5'7 157lbs 1.70 71.21 USA
## 10 \200375K Right CB 6'2 185lbs 1.88 83.91 USA
## confederaion continent
## 1 CONMEBOL SOUTH AMERICA
## 2 CONMEBOL SOUTH AMERICA
## 3 CONMEBOL SOUTH AMERICA
## 4 CONMEBOL SOUTH AMERICA
## 5 CONMEBOL SOUTH AMERICA
## 6 CONMEBOL SOUTH AMERICA
## 7 CONMEBOL SOUTH AMERICA
## 8 CONMEBOL SOUTH AMERICA
## 9 CONMEBOL SOUTH AMERICA
## 10 CONMEBOL SOUTH AMERICA
datos.fifa.only.club.coutry <- select(datos.fifa.reduc.merge, Club, country)
datos.fifa.only.club.coutry <- distinct(datos.fifa.only.club.coutry)
head(datos.fifa.only.club.coutry)
## Club country
## 1
## 2 SSV Jahn Regensburg
## 3 1. FC Heidenheim 1846
## 4 1. FC Kaiserslautern
## 5 1. FC Köln Germany
## 6 1. FC Magdeburg Germany
tabla <- data.frame(fdt_cat(datos.fifa.only.club.coutry$country)) %>%
select (Category,f)
names(tabla) <- c("Country", "Equipos")
#tabla
tabla <- tabla[-1,] # Quita el primer registros que son los valores vacios
#o se puede hacer con
tabla <- filter(tabla, !Country == "")
head(tabla , 10)
## Country Equipos
## 1 England 48
## 2 Spain 28
## 3 USA 24
## 4 Italy 23
## 5 Germany 22
## 6 México 18
## 7 France 15
## 8 Argentina 12
## 9 China 10
## 10 Brazil 9
tail(tabla , 10)
## Country Equipos
## 23 South Corea 3
## 24 Turkey 3
## 25 Austria 2
## 26 Canada 2
## 27 Scotland 2
## 28 Ucrania 2
## 29 Australia 1
## 30 Corea 1
## 31 Denmark 1
## 32 Uruguay 1
ggplot(data = head(tabla,10), aes(Country, Equipos, color=Country)) +
geom_col()
ggplot(data = tail(tabla,10), aes(Country, Equipos, color=Country)) +
geom_col()
jug.por.club <- datos.fifa.reduc.merge %>%
group_by (Club) %>%
summarise(n = n())
jug.por.club
## # A tibble: 638 x 2
## Club n
## <chr> <int>
## 1 "" 241
## 2 " SSV Jahn Regensburg" 29
## 3 "1. FC Heidenheim 1846" 28
## 4 "1. FC Kaiserslautern" 26
## 5 "1. FC Köln" 28
## 6 "1. FC Magdeburg" 26
## 7 "1. FC Nürnberg" 29
## 8 "1. FC Union Berlin" 28
## 9 "1. FSV Mainz 05" 32
## 10 "Aalborg BK" 27
## # ... with 628 more rows
jug.por.club.top.ten <- head(arrange(jug.por.club, desc(n)),10)
jug.por.club.top.ten
## # A tibble: 10 x 2
## Club n
## <chr> <int>
## 1 "" 241
## 2 "Arsenal" 33
## 3 "AS Monaco" 33
## 4 "Atlético Madrid" 33
## 5 "Borussia Dortmund" 33
## 6 "Burnley" 33
## 7 "Cardiff City" 33
## 8 "CD Leganés" 33
## 9 "Chelsea" 33
## 10 "Eintracht Frankfurt" 33
jug.por.club.bot.ten <- tail(arrange(jug.por.club, desc(n)),10)
jug.por.club.bot.ten
## # A tibble: 10 x 2
## Club n
## <chr> <int>
## 1 Grêmio 20
## 2 Internacional 20
## 3 Paraná 20
## 4 Santos 20
## 5 Sport Club do Recife 20
## 6 Tromsø IL 20
## 7 Vitória 20
## 8 Limerick FC 19
## 9 Sligo Rovers 19
## 10 Derry City 18
datos.fifa.reduc.merge.Value <- datos.fifa.reduc.merge %>%
mutate(datos.fifa.reduc.merge, Valor = ifelse (substr(Value, nchar(Value), nchar(Value)) == 'M', fcleanValue(Value) * 1000000, fcleanValue(Value) * 1000)) %>%
filter(Valor > 0)
head(datos.fifa.reduc.merge.Value)
## Club Name Age Nationality Overall Potential Value
## 1 SSV Jahn Regensburg H. Al Ghaddioui 27 Morocco 64 64 \200475K
## 2 SSV Jahn Regensburg A. Dej 26 Poland 67 70 \200925K
## 3 SSV Jahn Regensburg M. Thalhammer 20 Germany 61 72 \200425K
## 4 SSV Jahn Regensburg A. Weis 28 Germany 68 69 \200725K
## 5 SSV Jahn Regensburg H. Hyseni 25 Germany 58 61 \200160K
## 6 SSV Jahn Regensburg S. Freis 33 Germany 66 66 \200400K
## Preferred.Foot Position Height Weight Estatura Pesokgs country confederaion
## 1 Right ST 6'3 203lbs 1.91 92.08
## 2 Right CM 5'9 163lbs 1.75 73.94
## 3 Right CM 6'3 181lbs 1.91 82.10
## 4 Right GK 6'2 185lbs 1.88 83.91
## 5 Right ST 6'4 194lbs 1.93 88.00
## 6 Right LM 6'0 172lbs 1.83 78.02
## continent Valor
## 1 475000
## 2 925000
## 3 425000
## 4 725000
## 5 160000
## 6 400000
tail(datos.fifa.reduc.merge.Value)
## Club Name Age Nationality Overall Potential Value
## 17584 Yokohama F. Marinos O. Boumal 28 Cameroon 72 72 \2003.1M
## 17585 Yokohama F. Marinos K. Matsubara 25 Japan 67 72 \200850K
## 17586 Yokohama F. Marinos T. Kida 23 Japan 68 74 \2001M
## 17587 Yokohama F. Marinos K. Nakamachi 32 Japan 65 65 \200300K
## 17588 Yokohama F. Marinos K. Yamada 18 Japan 52 63 \20070K
## 17589 Yokohama F. Marinos I. Shinozuka 23 Russia 57 61 \200140K
## Preferred.Foot Position Height Weight Estatura Pesokgs country
## 17584 Left RM 6'0 148lbs 1.83 67.13
## 17585 Right RB 5'11 161lbs 1.80 73.03
## 17586 Right CDM 5'7 139lbs 1.70 63.05
## 17587 Right CDM 5'9 163lbs 1.75 73.94
## 17588 Right RB 5'9 132lbs 1.75 59.87
## 17589 Right RM 5'10 148lbs 1.78 67.13
## confederaion continent Valor
## 17584 3100000
## 17585 850000
## 17586 1000000
## 17587 300000
## 17588 70000
## 17589 140000
datos.fifa.reduc.merge.Value <- datos.fifa.reduc.merge.Value %>%
filter(!continent == "")
mean.Valor.continente <- datos.fifa.reduc.merge.Value %>%
group_by(continent) %>%
summarise(media = mean(Valor))
mean.Valor.continente
## # A tibble: 5 x 2
## continent media
## <chr> <dbl>
## 1 ASIA 1473879.
## 2 EUROPE 5360557.
## 3 NORTH AMERICA 1763361.
## 4 OCEANIA 747600
## 5 SOUTH AMERICA 2159836.
ggplot(datos.fifa.reduc.merge.Value, aes(x=continent, y=Valor )) +
geom_boxplot() +
geom_hline(yintercept = mean(datos.fifa.reduc.merge.Value$Valor ), color = "red") +
labs(title = "Valor económico de los jugadores", subtitle = paste("Valor económico medio = ", round(mean(datos.fifa.reduc.merge.Value$Valor ),2)))
ggplot(datos.fifa.reduc.merge.Value, aes(x=continent, y=Valor)) +
geom_boxplot() +
geom_jitter(aes(color = continent)) +
geom_hline(yintercept = mean(datos.fifa.reduc.merge.Value$Valor), color = "red") +
labs(title = "Valor económico de los jugadores", subtitle = paste("Valor económico medio = ", round(mean(datos.fifa.reduc.merge.Value$Valor),2)))
datos.fifa.pie.preferido <- datos.fifa %>%
group_by(Preferred.Foot) %>%
summarise(cuantos = n(), porc = paste(round(n() / nrow(datos.fifa) * 100,2),"%"))
datos.fifa.pie.preferido
## # A tibble: 3 x 3
## Preferred.Foot cuantos porc
## <chr> <int> <chr>
## 1 "" 48 0.26 %
## 2 "Left" 4211 23.13 %
## 3 "Right" 13948 76.61 %
ggplot(data=datos.fifa.reduc.merge.Value, aes(continent, Estatura, color=continent)) +
geom_boxplot() + # dibujamos el diagrama de cajas
stat_summary(fun.y=mean, geom="point",shape=18,
size=3, color="red") +
geom_hline(yintercept = mean(datos.fifa.reduc.merge.Value$Estatura, na.rm = TRUE), color="red") +
labs(title = "Estatura media de jugadores por Continente", subtitle = paste("Media total = ", round(mean(datos.fifa.reduc.merge.Value$Estatura, na.rm = TRUE),2)))
ggplot(data=datos.fifa.reduc.merge.Value, aes(continent, Pesokgs, color=continent)) +
geom_boxplot() + # dibujamos el diagrama de cajas
stat_summary(fun.y=mean, geom="point",shape=18,
size=3, color="red") +
geom_hline(yintercept = mean(datos.fifa.reduc.merge.Value$Pesokgs, na.rm = TRUE), color="red") +
labs(title = "Peso medio de jugadores por Continente", subtitle = paste("Media total = ", round(mean(datos.fifa.reduc.merge.Value$Pesokgs, na.rm = TRUE),2)))
En este conjunto de datos podemos apreciar que hay muchos registros de futbolistas de distintos países sin embargo, algunos países tienen más jugadores registrados que otros, en este análisis pudimos ver que el país que tiene mas jugadores registrados es Inglaterra con un total de 1662 jugadores registrados y en cuanto a los países como Nueva Caledonia o Sur de Cudan que tiene solamente un jugador registrado. En cuanto a la edad de esos jugadores nos podemos dar cuenta que el país que tiene la menor edad media en sus jugadores siendo esta de 23 años es Nigeria en donde tiene los jugadores más jóvenes y el país que tiene la mayor media de edad que es de 27 años es Brasil. En cuanto a la variedad de equipos que existen y que pueden contratar a estos jugadores es bastante amplia en muchos países, dentro de este análisis nos podemos dar cuenta que el país que tiene el mayor número de equipos registrados es Inglaterra con un total de 48 equipos mientras que los países que solamente tienen un equipo registrado son Uruguay, Australia, Corea y Denmark. Y en cuanto a los Clubs el que tiene más jugadores es Arsenal con 33 jugadores y el que tiene menos jugadores es Derry City con 18 jugadores, sin embargo, también nos podemos dar cuenta que el numero de jugadores que no pertenece a ningún club es bastante alto este es de 241. En cuanto al pago de los jugadores nos podemos dar cuenta que su pago promedio es de 4133051.4 euros y nos podemos dar cuenta que en el continente donde pagan más es en Europa con un promedio Total de 5360557 euros, en donde muchos de esos jugadores reciben más del promedio de pago y el continente donde pagan menos es Oceanía con un promedio de pago de 747600 euros en donde casi ninguno de sus jugadores alcanza el promedio de pago. Y en cuanto al físico de los jugadores nos podemos dar cuenta que mas del 70% de jugadores es Derecho y menos del 30% es Zurdo en cuanto a su pierna dominante, y en cuanto a estatura, nos damos cuenta que en promedio es 1.81 m y los jugadores mas altos se encuentran en Europa, y los mas bajitos se encuentran en Norte América y Sudamérica, en cuanto a peso es de 75 kilos en general todos se encuentran dentro de este promedio sin embargo nos podemos dar cuenta que los menos pesados están en Asia y Sudamérica.