This report analyzes the NOAA Storm Database to identify weather events most harmful to population health and those with the greatest economic consequences across the United States.
library(dplyr)
library(ggplot2)
storm_data <- read.csv("repdata_data_StormData1.csv", stringsAsFactors=FALSE)
health <- storm_data %>%
group_by(EVTYPE) %>%
summarise(total = sum(FATALITIES + INJURIES, na.rm=TRUE)) %>%
arrange(desc(total)) %>%
head(10)
economic <- storm_data %>%
group_by(EVTYPE) %>%
summarise(total = sum(PROPDMG + CROPDMG, na.rm=TRUE)) %>%
arrange(desc(total)) %>%
head(10)
ggplot(health, aes(reorder(EVTYPE, total), total)) +
geom_bar(stat="identity", fill="steelblue") +
coord_flip() +
labs(title="Top 10 Events by Health Impact",
x="Event Type", y="Total Fatalities and Injuries")
ggplot(economic, aes(reorder(EVTYPE, total), total)) +
geom_bar(stat="identity", fill="darkorange") +
coord_flip() +
labs(title="Top 10 Events by Economic Damage",
x="Event Type", y="Total Property and Crop Damage")