Created
February 2, 2018 19:35
-
-
Save atyre2/b564d163083fce83de4c0abe03c96b87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
library(tidyverse) | |
webpage <- read_html("http://snr.unl.edu/aboutus/who/people/wellness/flightascendingsummary.asp") | |
tbls <- html_nodes(webpage, "table") %>% | |
html_table() %>% | |
.[[1]] %>% | |
separate(Participant, into = c("Last Name", "First Name"), sep = ",") %>% | |
mutate(`Flights per day` = `Total Number of Flights` / `Total Number of Days`, | |
`Last Name` = factor(`Last Name`)) %>% | |
mutate(`Last Name` = forcats::fct_reorder(`Last Name`, `Flights per day`)) | |
ggplot(data = tbls, | |
mapping = aes(x = `Last Name`, y = `Total Number of Flights`, color=`Total Number of Days`)) + | |
geom_point() + | |
coord_flip() + | |
geom_hline(yintercept = 60, color="peachpuff2", linetype = 2) + | |
scale_color_distiller(palette = "PuRd", limits = c(1,28)) + | |
theme_classic(base_size = 11) + | |
theme(legend.position = "top") + | |
labs(caption = "Flights Ascending Leaderboard, Feb 2, 2018.\nSchool of Natural Resources, University of Nebraska-Lincoln") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment