# packages to install
library(tidyverse)
# install.packages("usmap")
library(usmap)
# install.packages("clock")
#
# just install, do not call library on usmap
Hurricane Data
with usmap()
Hurricane Data
One interesting analysis is
. Hurricane Data Analysis in R
Another, lighter visualization:
. Hurricane Watch from FlowingData.
New packages
Updated Storms Data
Plot trajectories on a map
# load updated storms data
<- read_csv("../data/storms.csv") |>
storms # the usmap_transform() function requires "lon"
rename(lon = long) |>
mutate(category = as_factor(category))
<- storms |>
df_s filter(status == "hurricane",
as.numeric(category) > 2,
== 2023)
year
# project lon/lat coords to match the usmap projection
# be sure to look at names(df_t)
<- usmap_transform(df_s)
df_t
# can also do: include = c("CO","MI") below
plot_usmap(include = .south_region) +
# geom_sf does a lot for you here,
# as it uses the "geometry" variable to determine location on map
geom_sf(data = df_t) +
geom_sf_label(data = df_t, aes(label = name))
# date_build uses the "clock" library
<- storms |> mutate(
storms date = clock::date_build(year, month, day))
|>
storms filter(status == "hurricane",
== 2023) |>
year ggplot(
aes(
x = date,
y = name,
color = category)) +
# geom_line(size=2) +
geom_point(aes(size = category))