Question

How are the drone sightings distributed around the USA?

Get the data

URL1 <- "http://www.faa.gov/uas/media/UAS_Sightings_report_21Aug-31Jan.xlsx"
URL2 <- "http://www.faa.gov/uas/media/UASEventsNov2014-Aug2015.xls"

fil1 <- paste0("../data/", basename(URL1))
fil2 <- paste0("../data/", basename(URL2))

if (!file.exists(fil1)) download.file(URL1, fil1)
if (!file.exists(fil2)) download.file(URL2, fil2)

xl1 <- read_excel(fil1)
xl2 <- read_excel(fil2)

The two data frames are merged and variables renamed for easy use later on.

report <- setNames(bind_rows(xl2[,1:3], arrange(xl1, EventDATETIME)[,c(1,3,4)]), c("timestamp", "city", "state")) %>% 
    mutate(place = paste(city, state, sep = ", ")) %>% 
    select(timestamp, place) 

Now I geocode the locations of the drone sightings and create a tidy data frame with the place names and coordinates.

report <- cbind(report, geocode(report$place, output = "latlona", source = "google"))
report_f <- filter(report, lat > 25 & lat < 50, lon > -125 | lon < -70) %>% 
    mutate(quarter = quarter(timestamp, with_year = TRUE))

The geocoded data set is saved and read back in when knitting the r markdown, thus no need to geocode again.

saveRDS(report_f, file = "./data/drone_sightings_2014-2016.rds")
report_f <- readRDS(file = "../data/drone_sightings_2014-2016.rds")

Plot the reported drone sightings per quarter.

usa <- map_data("state")

sp_minimal  <- theme_void(base_size = 12, base_family = "Cabin") +
    theme(axis.text = element_blank(),
          axis.title = element_blank(),
          axis.ticks = element_blank())

ggplot(report_f) + 
    geom_map(data = usa, aes(x = long, y = lat, map_id = region), map = usa, fill = "white", color = "#808080", size = 0.15) + 
    coord_proj("+proj=merc") +
    sp_minimal +
    geom_point(aes(x = lon, y = lat), size = 0.2, color = "#404040") + 
    stat_bkde2d(aes(x = lon, y = lat, fill = ..level.., alpha = ..level..), bandwidth = c(2,2), geom = "polygon") + 
    scale_fill_gradient(low = "#ffeda0", high = "#f03b20") +
    facet_wrap(~quarter) +
    guides(fill="none", alpha="none") +
    labs(title = "Quarterly drone sightings on mainland USA", subtitle = "As reported to the Federal Aviation Association", caption = "Data from: http://www.faa.gov/uas/law_enforcement/uas_sighting_reports/") +
    theme(strip.text.x = element_text(size=8, face="bold", family = "Cabin" ), title = element_text(size = 14,face = "bold", family = "Cabin"))