This analysis explores the NOAA Storm Database to identify severe weather events that have the greatest impact on public health and economic damage in the United States. Public health impact is measured by fatalities and injuries, while economic impact is assessed through property and crop damage. The data was processed and aggregated by event type. Results show that tornadoes are the most harmful events in terms of population health, causing the highest number of fatalities and injuries. In contrast, floods and hurricanes result in the greatest economic damage. These findings highlight the importance of disaster preparedness and resource allocation for high-impact weather events.
# Install packages if not already installed
if(!require(dplyr)) install.packages("dplyr")
## Loading required package: dplyr
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
if(!require(ggplot2)) install.packages("ggplot2")
## Loading required package: ggplot2
library(dplyr)
library(ggplot2)
# Load data (make sure file is in working directory)
data <- read.csv("repdata_data_StormData.csv.bz2")
# Select relevant columns
data2 <- data %>%
select(EVTYPE, FATALITIES, INJURIES, PROPDMG, CROPDMG)
# Calculate health impact
health <- data2 %>%
group_by(EVTYPE) %>%
summarise(total = sum(FATALITIES + INJURIES, na.rm = TRUE)) %>%
arrange(desc(total))
## `summarise()` ungrouping output (override with `.groups` argument)
health_top <- head(health, 10)
# Calculate economic impact
econ <- data2 %>%
group_by(EVTYPE) %>%
summarise(total = sum(PROPDMG + CROPDMG, na.rm = TRUE)) %>%
arrange(desc(total))
## `summarise()` ungrouping output (override with `.groups` argument)
econ_top <- head(econ, 10)