Skip to content

Instantly share code, notes, and snippets.

@turgeonmaxime
Created January 21, 2022 15:13
Show Gist options
  • Save turgeonmaxime/7f205575320be7056de4cc58b447eacf to your computer and use it in GitHub Desktop.
Save turgeonmaxime/7f205575320be7056de4cc58b447eacf to your computer and use it in GitHub Desktop.
library(tidyverse)
library(nycflights13)

delay <- flights |> 
    group_by(dest) |> 
    summarize(means = mean(dep_delay, na.rm = TRUE))

joined <- inner_join(delay, flights, by = "dest")

airports |> 
    inner_join(joined, c("faa" = "dest")) |> 
    group_by(means) |> 
    ggplot(aes(lon, lat, col = means)) + 
    borders("state") +
    geom_point() + 
    coord_quickmap()

Created on 2022-01-21 by the reprex package (v2.0.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment