This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(readxl)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggrepel)
library(rmarkdown)
library(janitor)
##
## Attaching package: 'janitor'
##
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
datos_session <- read_excel("Datos_sesion.xlsx")
str(datos_session)
## tibble [23 × 23] (S3: tbl_df/tbl/data.frame)
## $ Date : POSIXct[1:23], format: "2023-08-11" "2023-08-11" ...
## $ Name : chr [1:23] "Tatum, Taylor" "Mcmillin, David" "Hunter, Andrew" "Mccune, Colton" ...
## $ Type : chr [1:23] "TRAINING SESSION" "TRAINING SESSION" "TRAINING SESSION" "TRAINING SESSION" ...
## $ Position Name : chr [1:23] "MEDIA PUNTA" "MEDIO CENTRO" "DELANTERO" "DELANTERO" ...
## $ Total Duration : num [1:23] 52.6 52.6 52.6 44.8 52.6 52.6 52.6 52.6 52.6 52.6 ...
## $ Total Distance (m) : num [1:23] 3939 4085 3841 2142 4194 ...
## $ Total Player Load : num [1:23] 367 346 353 240 358 351 386 311 377 335 ...
## $ High speed distance (m) : num [1:23] 139 183 166 105 154 199 150 94 184 164 ...
## $ High speed efforts : num [1:23] 6 15 13 7 10 15 10 5 14 13 ...
## $ Sprint distance (m) : num [1:23] 0 0 0 0 0 15 0 0 1 0 ...
## $ Sprints efforts : num [1:23] 0 0 0 0 0 1 0 0 0 0 ...
## $ Maximum Velocity (km/h) : num [1:23] 20.8 23.2 85.9 22.4 22.2 25.1 21.7 20.4 24.1 21.9 ...
## $ Max Acceleration : num [1:23] 2.2 2.7 2.5 2.9 2.7 2.9 2.4 2.1 3.4 2 ...
## $ Max Deceleration : num [1:23] -2.4 -2.9 -3.2 -2.8 -2.6 -3.6 -2.6 -1.9 -2.8 -2.4 ...
## $ Acceleration B1 Efforts (Gen 2) : num [1:23] 6 6 2 5 9 6 7 3 7 1 ...
## $ Acceleration B2 Efforts (Gen 2) : num [1:23] 0 0 0 0 0 0 0 0 1 0 ...
## $ Acceleration B3 Efforts (Gen 2) : num [1:23] 0 0 0 0 0 0 0 0 0 0 ...
## $ Acceleration B1-3 Total Efforts (Gen 2): num [1:23] 6 6 2 5 9 6 7 3 8 1 ...
## $ Deceleration B1 Efforts (Gen 2) : num [1:23] 6 8 6 6 7 7 8 0 8 2 ...
## $ Deceleration B2 Efforts (Gen 2) : num [1:23] 0 0 1 0 0 2 0 0 0 0 ...
## $ Deceleration B3 Efforts (Gen 2) : num [1:23] 0 0 0 0 0 0 0 0 0 0 ...
## $ Deceleration B1-3 Total Efforts (Gen 2): num [1:23] 6 8 7 6 7 9 8 0 8 2 ...
## $ Player Peak Velocity : num [1:23] 30.8 31.7 31.8 33.7 28.4 ...
summary(datos_session)
## Date Name Type Position Name
## Min. :2023-08-11 Length:23 Length:23 Length:23
## 1st Qu.:2023-08-11 Class :character Class :character Class :character
## Median :2023-08-11 Mode :character Mode :character Mode :character
## Mean :2023-08-11
## 3rd Qu.:2023-08-11
## Max. :2023-08-11
## Total Duration Total Distance (m) Total Player Load High speed distance (m)
## Min. : 0.00 Min. : 0 Min. : 0.0 Min. : 0.0
## 1st Qu.:52.60 1st Qu.:3876 1st Qu.:331.0 1st Qu.:130.5
## Median :52.60 Median :3986 Median :346.0 Median :156.0
## Mean :49.97 Mean :3840 Mean :335.1 Mean :149.3
## 3rd Qu.:52.60 3rd Qu.:4238 3rd Qu.:369.5 3rd Qu.:176.5
## Max. :52.60 Max. :4813 Max. :421.0 Max. :210.0
## High speed efforts Sprint distance (m) Sprints efforts
## Min. : 0.00 Min. : 0.000 Min. :0.0000
## 1st Qu.: 8.00 1st Qu.: 0.000 1st Qu.:0.0000
## Median :11.00 Median : 0.000 Median :0.0000
## Mean :10.65 Mean : 2.348 Mean :0.1739
## 3rd Qu.:14.00 3rd Qu.: 0.000 3rd Qu.:0.0000
## Max. :17.00 Max. :20.000 Max. :2.0000
## Maximum Velocity (km/h) Max Acceleration Max Deceleration
## Min. : 0.00 Min. :0.000 Min. :-3.600
## 1st Qu.:21.75 1st Qu.:2.250 1st Qu.:-2.900
## Median :22.80 Median :2.500 Median :-2.700
## Mean :24.59 Mean :2.465 Mean :-2.596
## 3rd Qu.:24.00 3rd Qu.:2.800 3rd Qu.:-2.400
## Max. :85.90 Max. :3.400 Max. : 0.000
## Acceleration B1 Efforts (Gen 2) Acceleration B2 Efforts (Gen 2)
## Min. :0.000 Min. :0.00000
## 1st Qu.:3.000 1st Qu.:0.00000
## Median :5.000 Median :0.00000
## Mean :4.478 Mean :0.08696
## 3rd Qu.:6.000 3rd Qu.:0.00000
## Max. :9.000 Max. :1.00000
## Acceleration B3 Efforts (Gen 2) Acceleration B1-3 Total Efforts (Gen 2)
## Min. :0 Min. :0.000
## 1st Qu.:0 1st Qu.:3.000
## Median :0 Median :5.000
## Mean :0 Mean :4.565
## 3rd Qu.:0 3rd Qu.:6.000
## Max. :0 Max. :9.000
## Deceleration B1 Efforts (Gen 2) Deceleration B2 Efforts (Gen 2)
## Min. :0.000 Min. :0.0000
## 1st Qu.:6.000 1st Qu.:0.0000
## Median :7.000 Median :0.0000
## Mean :6.174 Mean :0.2174
## 3rd Qu.:8.000 3rd Qu.:0.0000
## Max. :9.000 Max. :2.0000
## Deceleration B3 Efforts (Gen 2) Deceleration B1-3 Total Efforts (Gen 2)
## Min. :0 Min. :0.000
## 1st Qu.:0 1st Qu.:6.000
## Median :0 Median :7.000
## Mean :0 Mean :6.391
## 3rd Qu.:0 3rd Qu.:8.000
## Max. :0 Max. :9.000
## Player Peak Velocity
## Min. :25.70
## 1st Qu.:30.32
## Median :31.30
## Mean :31.07
## 3rd Qu.:32.37
## Max. :33.86
datos_session_clean <- clean_names(datos_session)
view(datos_session_clean)
datos_session_clean <- clean_names(datos_session)
datos_session_clean %>%
filter(!name=="Grant, Joshua")
## # A tibble: 22 × 23
## date name type position_name total_duration total_distance_m
## <dttm> <chr> <chr> <chr> <dbl> <dbl>
## 1 2023-08-11 00:00:00 Tatu… TRAI… MEDIA PUNTA 52.6 3939
## 2 2023-08-11 00:00:00 Mcmi… TRAI… MEDIO CENTRO 52.6 4085
## 3 2023-08-11 00:00:00 Hunt… TRAI… DELANTERO 52.6 3841
## 4 2023-08-11 00:00:00 Mccu… TRAI… DELANTERO 44.8 2142
## 5 2023-08-11 00:00:00 Ande… TRAI… MEDIO CENTRO 52.6 4194
## 6 2023-08-11 00:00:00 Phoe… TRAI… LATERAL 52.6 4220
## 7 2023-08-11 00:00:00 Lafo… TRAI… DELANTERO 52.6 4000
## 8 2023-08-11 00:00:00 Nels… TRAI… LATERAL 52.6 3946
## 9 2023-08-11 00:00:00 Mart… TRAI… EXTREMO 52.6 3979
## 10 2023-08-11 00:00:00 Howd… TRAI… CENTRAL 52.6 4077
## # ℹ 12 more rows
## # ℹ 17 more variables: total_player_load <dbl>, high_speed_distance_m <dbl>,
## # high_speed_efforts <dbl>, sprint_distance_m <dbl>, sprints_efforts <dbl>,
## # maximum_velocity_km_h <dbl>, max_acceleration <dbl>,
## # max_deceleration <dbl>, acceleration_b1_efforts_gen_2 <dbl>,
## # acceleration_b2_efforts_gen_2 <dbl>, acceleration_b3_efforts_gen_2 <dbl>,
## # acceleration_b1_3_total_efforts_gen_2 <dbl>, …
datos_session_clean <- clean_names(datos_session)
datos_session_clean %>%
filter(!name=="Grant, Joshua")
## # A tibble: 22 × 23
## date name type position_name total_duration total_distance_m
## <dttm> <chr> <chr> <chr> <dbl> <dbl>
## 1 2023-08-11 00:00:00 Tatu… TRAI… MEDIA PUNTA 52.6 3939
## 2 2023-08-11 00:00:00 Mcmi… TRAI… MEDIO CENTRO 52.6 4085
## 3 2023-08-11 00:00:00 Hunt… TRAI… DELANTERO 52.6 3841
## 4 2023-08-11 00:00:00 Mccu… TRAI… DELANTERO 44.8 2142
## 5 2023-08-11 00:00:00 Ande… TRAI… MEDIO CENTRO 52.6 4194
## 6 2023-08-11 00:00:00 Phoe… TRAI… LATERAL 52.6 4220
## 7 2023-08-11 00:00:00 Lafo… TRAI… DELANTERO 52.6 4000
## 8 2023-08-11 00:00:00 Nels… TRAI… LATERAL 52.6 3946
## 9 2023-08-11 00:00:00 Mart… TRAI… EXTREMO 52.6 3979
## 10 2023-08-11 00:00:00 Howd… TRAI… CENTRAL 52.6 4077
## # ℹ 12 more rows
## # ℹ 17 more variables: total_player_load <dbl>, high_speed_distance_m <dbl>,
## # high_speed_efforts <dbl>, sprint_distance_m <dbl>, sprints_efforts <dbl>,
## # maximum_velocity_km_h <dbl>, max_acceleration <dbl>,
## # max_deceleration <dbl>, acceleration_b1_efforts_gen_2 <dbl>,
## # acceleration_b2_efforts_gen_2 <dbl>, acceleration_b3_efforts_gen_2 <dbl>,
## # acceleration_b1_3_total_efforts_gen_2 <dbl>, …
datos_session_clean %>%
summarise(max(maximum_velocity_km_h))
## # A tibble: 1 × 1
## `max(maximum_velocity_km_h)`
## <dbl>
## 1 85.9
datos_session_clean %>%
filter(maximum_velocity_km_h > 40)
## # A tibble: 1 × 23
## date name type position_name total_duration total_distance_m
## <dttm> <chr> <chr> <chr> <dbl> <dbl>
## 1 2023-08-11 00:00:00 Hunte… TRAI… DELANTERO 52.6 3841
## # ℹ 17 more variables: total_player_load <dbl>, high_speed_distance_m <dbl>,
## # high_speed_efforts <dbl>, sprint_distance_m <dbl>, sprints_efforts <dbl>,
## # maximum_velocity_km_h <dbl>, max_acceleration <dbl>,
## # max_deceleration <dbl>, acceleration_b1_efforts_gen_2 <dbl>,
## # acceleration_b2_efforts_gen_2 <dbl>, acceleration_b3_efforts_gen_2 <dbl>,
## # acceleration_b1_3_total_efforts_gen_2 <dbl>,
## # deceleration_b1_efforts_gen_2 <dbl>, deceleration_b2_efforts_gen_2 <dbl>, …
distancia_min <- datos_session_clean %>%
mutate(d_x_m=`total_distance_m` / `total_duration`)
porc_max_velo_alcanzada <- datos_session_clean %>%
mutate(porc_max_veloc_alc=`maximum_velocity_km_h` / `player_peak_velocity`)
acel_b2_b3 <- datos_session_clean %>%
mutate(acel_b2_b3=`acceleration_b2_efforts_gen_2` + `acceleration_b3_efforts_gen_2`)
columnas_nuevas <- datos_session_clean %>%
mutate(d_x_m=`total_distance_m` / `total_duration`) %>%
mutate(porc_max_veloc_alc=`maximum_velocity_km_h` / `player_peak_velocity`) %>%
mutate(acel_b2_b3=`acceleration_b2_efforts_gen_2` + `acceleration_b3_efforts_gen_2`) %>%
select(name,d_x_m,porc_max_veloc_alc,acel_b2_b3)