Number of passengers at USA Airport TSA checkpoints for 2019, 2020, 2021 and 2022
install.packages('xml2') install.packages('rvest') install.packages('tidyverse') install.packages('janitor') #install.packages('themeani') #install.packages("ggplot2") #install.packages("magrittr") #install.packages("dplyr") library('xml2') library(rvest) library(tidyverse) library(ggplot2) library(dplyr) library('xml2') library(rvest) library(tidyverse) #read_html("https://www.tsa.gov/coronavirus/passenger-throughput?page=0") -> myurl #html_table(myurl, header = TRUE, fill = TRUE) -> tsa #working directory setwd("D:/projects/wordpress/ex280_tsa") tsa <- read.table("data_tsa.txt", header = TRUE, sep = "\t") tsa %>% janitor::clean_names() %>% rename( data_2019 = c2019, data_2020 = c2020, data_2021 = c2021, data_2022 = c2022 ) -> tsa2 png(file="tsa_2022_05.png",width=600, height=600) ggplot(tsa2) + geom_line(aes(x = date, y = data_2019,colour = "2019")) + geom_point(aes(x = date, y = data_2019,colour = "2019")) + geom_smooth(aes(x = date, y = data_2019,,colour = "2019"),span = 0.3) + # geom_line(aes(x = date, y = data_2020,colour = "2020"))+ geom_point(aes(x = date, y = data_2020,colour = "2020")) + geom_smooth(aes(x = date, y = data_2020,colour = "2020"),span = 0.3) + # geom_line(aes(x = date, y = data_2021,colour = "2021")) + geom_point(aes(x = date, y = data_2021,colour = "2021")) + geom_smooth(aes(x = date, y = data_2021,colour = "2021"),span = 0.3) + # geom_line(aes(x = date, y = data_2022,colour = "2022")) + geom_point(aes(x = date, y = data_2022,colour = "2022")) + geom_smooth(aes(x = date, y = data_2022,colour = "2022"),span = 0.6) + # scale_x_continuous(breaks = seq(0, 365, by = 14)) + scale_y_continuous(labels = scales::"comma") + scale_colour_manual(name = "Years", breaks = c("2019","2020","2021","2022"), values = c("darkgreen","red","blue","darkblue")) + theme(legend.position = c(0.8, 0.1)) + labs(x = "Day #",y = "Number of Passengers",title = "Number of passengers at USA Airport TSA checkpoints for 2019, 2020, 2021 and 2022") dev.off()
Recent Comments