knitr::opts_chunk$set( fig.width=7, collapse = TRUE, comment = "#>" )
The data comes from 2019 Giro road book and has been downloaded using the tabulizer package tabulizer::extract_tables("http://www.giroditalia.it/wp-content/uploads/2019/04/Garibaldi_Giro_italia_2019_low_res.pdf", pages = c(17, 18))
.
The following report is an analysis of Giro 2019 categorized climbs. It contains:
You can download the whole package including the data and all the reports with devtools::install_github("schubertjan/giro2019")
.
Below is a detailed overview of all classified climbs in chronological order. The x axis shows the length of a climb (km), the y axis elevation difference (m). All charts use the same axis to allow relative comparison. The colour represents climb's category.
library(giro2019) library(DT) DT::datatable(climbs[, c(1,4,5,11,12,13)], rownames = FALSE) x <- lapply(1:nrow(climbs), function(i) { dat <- giro2019::createhilldata(x = climbs$`lungh.(km)`[i], y = climbs$`disl.(m)`[i], cat = climbs$cat[i]) giro2019::hillplot(x = dat$x, y = dat$y, col_plot = dat$plot_col, x_lim = max(climbs$`lungh.(km)`), y_lim = max(climbs$`disl.(m)`), stage = climbs$tappa[i], climb_name = climbs$gpm[i], avg_p = climbs$p.med[i], max_p = climbs$p.max[i]) })
The chart below shows an overview of climbs by stages. Most of climbing action is packed between 1 and 2 rest day. Stage 20 is packed with climbing.
#pre-process data climbs_l <- split(climbs,climbs$tappa) n <- lapply(climbs_l,function(x) nrow(x) + 1) #creare NA for stages with < 5 climbs for(i in 1:length(climbs_l)){ if(n[i] != 6){ for(j in n[[i]]:5){ climbs_l[[i]][j, ] <- NA } } } climbs_full <- do.call(rbind, climbs_l) par(mfrow = c(19,5), mar = c(1,1,2,1)) x <- lapply(1:nrow(climbs_full), function(i) { #create data x <- c(0, climbs_full$`lungh.(km)`[i]) y <- c(0, climbs_full$`disl.(m)`[i]) #if no data plot empty else plot climb if(is.na(x[2])) { plot(0,0,type = "n", axes = FALSE,ann = FALSE) } else { dat <- giro2019::createhilldata(x = climbs_full$`lungh.(km)`[i], y = climbs_full$`disl.(m)`[i], cat = climbs_full$cat[i]) giro2019::hillplot(x = dat$x, y = dat$y, col_plot = dat$plot_col, x_lim = max(climbs_full$`lungh.(km)`, na.rm = TRUE), y_lim = max(climbs_full$`disl.(m)`, na.rm = TRUE), stage = climbs_full$tappa[i], climb_name = climbs_full$gpm[i], showaxis = FALSE) } })
This chart shows total elevation gained in categorized climbs. Vertical lines show rest days. Stage 20 is brutal; more than 4600m of categorized climbing!
elev_stage <- aggregate(`disl.(m)` ~ tappa, data = climbs, FUN = sum) barplot(height = elev_stage$`disl.(m)`, names.arg = elev_stage$tappa, xlab = "Stage", ylab = "Total Elevation", main = "Total Elevation Gained in Categorized Climbs", cex.axis = .8, cex.names = .8) abline(v = 9.7) abline(v = 15.7) DT::datatable(elev_stage, rownames = FALSE, options = list(pageLength = 10))
No surprise here, a few climbs look pretty steep for cat 4 :)
climbs <- climbs[order(climbs$`disl.(m)`), ] par(mfrow = c(13,3), mar = c(2,1,2,1)) x <- lapply(1:nrow(climbs), function(i) { dat <- giro2019::createhilldata(x = climbs$`lungh.(km)`[i], y = climbs$`disl.(m)`[i], cat = climbs$cat[i]) giro2019::hillplot(x = dat$x, y = dat$y, col_plot = dat$plot_col, x_lim = max(climbs$`lungh.(km)`), y_lim = max(climbs$`disl.(m)`), stage = climbs$tappa[i], climb_name = climbs$gpm[i], avg_p = climbs$p.med[i], max_p = climbs$p.max[i], showaxis = TRUE) })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.