Background/Objective:

This case study aims to analyze historical storm data by using NOAA Storm data for the hurricanes that hit the United States after the year 1950, and to quantify how many storms have hit each of the 50 United States. A summary plot of all the storms to hit the United States will be created. The final product will be a table with the top five states with the highest number of storms since 1950.
library(sf)
library(tidyverse)
library(ggmap)
library(rnoaa)
library(spData)
data(world)
data(us_states)

Data:

Read the storm data:

storm <- read_sf("08b_data/Basin.NA.ibtracs_all_points.v03r10.shp")

Methods:

Wrangle the data:

First we filter the storms to reflect only storms from 1950 to present day, then we make all the columns numeric, and finally we add a column that indicates a decade value.
filteredStorm<-storm %>% filter(Season>="1950") %>% 
  dplyr::mutate_if(is.numeric, function(x) ifelse(x==-999.0,NA,x)) %>% 
  mutate(decade=floor(Season/10)*10)
The next lines of code identify the bounding box of storm data and filter the world data by this new bounded box of storm data called “region”
region<-st_bbox(filteredStorm)
filteredWorld<-st_crop(world, region)
## although coordinates are longitude/latitude, st_intersection assumes that they are planar
## Warning: attribute variables are assumed to be spatially constant throughout all
## geometries

Results:

Summary plot of all storms to hit the United States after 1950:

ggplot() +
  geom_sf(data=filteredWorld, inherit.aes= FALSE, fill="grey", colour="black")+
  stat_bin2d(data=filteredStorm, aes(y=st_coordinates(filteredStorm)[,2], x=st_coordinates(filteredStorm)[,1]),bins=100) + 
  scale_fill_distiller(palette="YlOrRd", trans="log", direction=-1, breaks = c(1,10,100,1000))+ #sets color ramp
  facet_wrap(~decade, nrow=2)+ #creates multiple plot panels for multiple decades
  coord_sf(ylim=region[c(2,4)], xlim=region[c(1,3)])+ #crops the plot to region
  labs(title="Hurricanes in the United States\nafter 1950")+
  xlab("Latitude")+
  ylab("Longitude")+
  theme_classic()+
  theme(legend.position="bottom")+
  theme(plot.title = element_text(hjust=0.5))+ 
  theme(axis.text.x = element_text(angle=90, hjust=1))

Prepare to set up table:

We use st_transform to reproject us_states to the coordinate reference system of the filteredStorm object
st_crs(filteredStorm) #gives us the crs value
## Coordinate Reference System:
##   EPSG: 4326 
##   proj4string: "+proj=longlat +datum=WGS84 +no_defs"
states<-st_transform(us_states, crs=4326)
Next we perform a spatial join between the filteredStorm database and our new states object:
storm_states <- st_join(filteredStorm, states, join = st_intersects,left = F)
## although coordinates are longitude/latitude, st_intersects assumes that they are planar
## although coordinates are longitude/latitude, st_intersects assumes that they are planar

Conclusion:

Calculate table with the five states with the most storms

table<-storm_states %>% 
  filter(Name!="UNNAMED") %>% #filter out storms with no name
  group_by(NAME) %>% 
  distinct(Name) %>% 
  count(Name) %>% 
  count(NAME, sort=TRUE) %>% 
  st_set_geometry(NULL)

knitr::kable(table[1:5,])
NAME n
Florida 76
North Carolina 50
Georgia 48
Texas 47
South Carolina 39
The states that have had the most hurricane hits since 1950 are, in order from highest to least; Florida, North Carolina, Georgia, Texas, and South Carolina. All of these states are located in the American Southeast, which is a hurricane prone area. Another interesting thing to look at would be which storms hit all 5 of these states to see what the most destructive US hurricanes were since 1950. Perhaps the next case study!