This analysis explores the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database. It identifies the most harmful weather events in terms of population health and economic impact.
library(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
library(ggplot2)
data <- read.csv("repdata_data_StormData.csv")
EVTYPE,
FATALITIES, INJURIES, PROPDMG,
and CROPDMG.data <- data %>%
select(EVTYPE, FATALITIES, INJURIES, PROPDMG, CROPDMG) %>%
mutate(EVTYPE = toupper(EVTYPE))
health_impact <- data %>%
group_by(EVTYPE) %>%
summarise(Total_Fatalities = sum(FATALITIES, na.rm = TRUE),
Total_Injuries = sum(INJURIES, na.rm = TRUE)) %>%
arrange(desc(Total_Fatalities + Total_Injuries)) %>%
head(10)
ggplot(health_impact, aes(x = reorder(EVTYPE, -(Total_Fatalities + Total_Injuries)),
y = Total_Fatalities + Total_Injuries)) +
geom_bar(stat = "identity", fill = "red") +
coord_flip() +
labs(title = "Top 10 Weather Events Affecting Population Health",
x = "Event Type",
y = "Total Fatalities and Injuries")
economic_impact <- data %>%
group_by(EVTYPE) %>%
summarise(Total_Damage = sum(PROPDMG + CROPDMG, na.rm = TRUE)) %>%
arrange(desc(Total_Damage)) %>%
head(10)
ggplot(economic_impact, aes(x = reorder(EVTYPE, -Total_Damage), y = Total_Damage)) +
geom_bar(stat = "identity", fill = "blue") +
coord_flip() +
labs(title = "Top 10 Weather Events with Economic Impact",
x = "Event Type",
y = "Total Property and Crop Damage")
This analysis highlights the most hazardous weather events in terms of human health and economic consequences. Tornadoes appear to be the most harmful to human life, while floods and hurricanes cause significant economic losses.