knitr::opts_chunk$set( fig.width = 7, fig.height = 4.5, collapse = TRUE, comment = "#>" )
The data comes from 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))
tabulizer::extract_tables("https://static2.giroditalia.it/wp-content/uploads/2017/04/Garibaldi_2017.pdf", pages = c(10))
tabulizer::extract_tables("https://legaciclismo.files.wordpress.com/2018/05/garibaldi-2018.pdf", pages = c(19, 20))
You can download the whole package including the data and all the reports with devtools::install_github("schubertjan/giro2019")
.
Riders did an extra 3000m of climbing in 2017 compared with 2019. 2019 sees 1800m more categorized climbing than last year, or one big category 1 climb.
library(giro2019) library(DT) #fill the data with all stages fill <- data.frame(tappa = 1:21) climbs_2019 <- merge(fill, climbs, by = "tappa", all.x = TRUE) fill <- data.frame(stage = 1:21) climbs_2018 <- merge(fill, climbs_2018, by = "stage", all.x = TRUE) climbs_2017 <- merge(fill, climbs_2017, by = "stage", all.x = TRUE) #replace NA climbs_2019$`disl.(m)` <- ifelse(is.na(climbs_2019$`disl.(m)`), 0, climbs_2019$`disl.(m)`) climbs_2018$disl.m <- ifelse(is.na(climbs_2018$disl.m), 0, climbs_2018$disl.m) climbs_2017$disl.m <- ifelse(is.na(climbs_2017$disl.m), 0, climbs_2017$disl.m) #create colours col_2017 <- rgb(200, 79, 178, maxColorValue = 255) col_2018 <- rgb(105, 147, 45, maxColorValue = 255) col_2019 <- rgb(85, 130, 169, maxColorValue = 255) comp <- data.frame(Year = factor(c("2017", "2018", "2019")), Total.elev = c(sum(climbs_2017$disl.m, na.rm = TRUE), sum(climbs_2018$disl.m, na.rm = TRUE), sum(climbs_2019$`disl.(m)`, na.rm = TRUE))) with(comp,barplot(Total.elev, names.arg = Year, xlab = "Stage", ylab = "Total Elevation (m)", main = "Total Elevation Gained in Categorized Climbs", cex.axis = .8, cex.names = .8, col = c(col_2017, col_2018, col_2019))) DT::datatable(comp, rownames = FALSE)
All building up for week 2 and 3. Unusually late GC action for Giro. On paper, stage 20 looks like the hardest in the last 3 years.
#summary by stage s_2019 <- with(climbs_2019, tapply(`disl.(m)`, tappa, sum)) s_2018 <- with(climbs_2018, tapply(disl.m, stage, sum)) s_2017 <- with(climbs_2017, tapply(disl.m, stage, sum)) plot(names(s_2017), s_2017, type = "b", lwd = 3, col = col_2017, ylim = c(0, max(c(s_2017, s_2018, s_2019))), main = "Total Elevation Gained in Categorized Climbs By Stages", ylab = "Total Elevation (m)", xlab = "Stage", cex.main = .8, cex.axis = .8, cex.lab = .8, xaxt="n", pch = 16) lines(s_2018, lwd = 3, pch = 16,col = col_2018, type = "b") lines(s_2019, lwd = 3, pch = 16, col = col_2019, type = "b") axis(1, labels = names(s_2017), at = names(s_2017), cex.axis = .8) legend("topleft", legend = c("2017", "2018", "2019"), col = c(col_2017, col_2018, col_2019), lwd = c(3,3,3), cex = .8) DT::datatable(data.frame(giro2017 = s_2017, giro2018 = s_2018, giro2019 = s_2019))
Despite little GC action in week 1, riders will end week 2 with about the same amount of gained elevation as in previous 2 years. Week 3 is tougher than last year.
#summary by stage cs_2017 <- cumsum(s_2017) cs_2018 <- cumsum(s_2018) cs_2019 <- cumsum(s_2019) #replace NA plot(names(s_2017), cs_2017, type = "b", lwd = 3, col = col_2017, ylim = c(0, max(c(cs_2017, cs_2018, cs_2019))), main = "Cumulative Total Elevation Gained in Categorized Climbs By Stages", ylab = "Cumulative Total Elevation (m)", xlab = "Stage", cex.main = .8, cex.axis = .8, cex.lab = .8, xaxt="n", pch = 16) lines(cs_2018, lwd = 3, pch = 16,col = col_2018, type = "b") lines(cs_2019, lwd = 3, pch = 16, col = col_2019, type = "b") axis(1, labels = names(s_2017), at = names(s_2017), cex.axis = .8) legend("topleft", legend = c("2017", "2018", "2019"), col = c(col_2017, col_2018, col_2019), lwd = c(3,3,3), cex = .8) DT::datatable(data.frame(giro2017 = cs_2017, giro2018 = cs_2018, giro2019 = cs_2019))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.