Chapter 5 Homework
Wikipedia
Problem
Using the approach described in Section 5.5.4, find another table in Wikipedia that can be scraped and visualized. Be sure to interpret your graphical display.
Solution
library(rvest)
url <- "https://en.wikipedia.org/wiki/Men%27s_100_metres_world_record_progression"
MenSprintRecords <-
read_html(url) %>%
html_nodes("table")
Since1977 <-
MenSprintRecords[[4]] %>%
html_table() %>%
select(Time, Date) %>%
mutate(Date= mdy(Date))
Since1977 %>%
ggplot(aes(x = Date, y = Time)) +
geom_point() +
geom_line() +
labs(y = "time (seconds)",
title = "100m Sprint World Records")100m Sprint World Records
The Men’s sprint world record was continuously improved over the years. However, because some records were ratified and later rescinded, it seems like the records’ times go up and down instead of continuously down.