#' scatter plot
#'
#' plotting arrival and departure delay
#'
#' @export
obs <- function(){
# retrieve data
flights <- read.csv("https://raw.githubusercontent.com/lucacerab/mrmee/master/inst/extdata/flights.csv")
aa <- flights[grepl('AA', flights$carrier), ]
assign("aa", aa, envir = .GlobalEnv)
# plot
ggplot(aa, aes(x = dep_delay, y = arr_delay)) +
ggtitle("American Airlines arr/dep delays") +
theme(plot.title = element_text(hjust = 0.5, size = 18)) +
xlab("departure delay (mins)") +
ylab("arrival delay (mins)") +
geom_point()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.