During the years 2012, 2018, 2021, and 2022, there were multiple consecutive days with temperatures above 100 degrees. We will code this as heatwave
.
library(epitools)
er_temps <-
er_temps %>%
mutate(heatwave = year %in% c(2012, 2018, 2021, 2022))
glimpse(er_temps)
Rows: 60
Columns: 10
$ year <dbl> 2011, 2011, 2011, 2011, 2011, 2012, 2012, 2012, 2012…
$ age <fct> 0-4 years, 15-34 years, 35-64 years, 5-14 years, 65+…
$ rate <dbl> 3.523598, 7.344520, 5.840845, 5.197288, 8.341661, 3.…
$ lower95cl <dbl> 1.820694, 5.946380, 4.800143, 3.499551, 5.981890, 1.…
$ upper95cl <dbl> 6.155016, 8.742659, 6.881547, 6.895024, 10.701431, 6…
$ visits <dbl> 12, 106, 121, 36, 48, 12, 130, 121, 29, 47, 17, 121,…
$ highest_temp <dbl> 98, 98, 98, 98, 98, 105, 105, 105, 105, 105, 100, 10…
$ no_days_above_100 <dbl> 0, 0, 0, 0, 0, 13, 13, 13, 13, 13, 2, 2, 2, 2, 2, 1,…
$ high_rate <lgl> FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE…
$ heatwave <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE,…