Creating a sliding window with the slider R package to quantify the level of drought (CC239)
The slider R package has a great set of slide
functions to bulid sliding windows across a tidy dataframe. The syntax is very similar to the map
functions from purrr. Watch as Pat shows how to quantify the amount of drought using the slide
and slide_dbl
functions from slider. He’ll also compare those functions to the lag
and lead
fuctions from dplyr. Finally, he makes a plot showing when droughts have occurred over the past 130 years in Southeastern Michigan. He does all this using local weather data downloaded from NOAA in RStudio with a lot of help from the tidyverse
Code
You can browse the state of the repository at the