This report analyzes the NOAA storm dataset to determine which types of events are most harmful to population health and which have the greatest economic impact. The analysis shows that tornadoes are the most harmful to population health, while floods and hurricanes cause the greatest economic damage.
The dataset was loaded using read.csv(). Relevant
variables such as event type, fatalities, injuries, and damage values
were used for the analysis. Property and crop damage values were
converted into actual numeric values using multipliers such as K
(thousands), M (millions), and B (billions).
data <- read.csv(file.choose(), stringsAsFactors = FALSE)
convert_exp <- function(exp) {
if (exp == "K") return(1e3)
if (exp == "M") return(1e6)
if (exp == "B") return(1e9)
return(1)
}
data$PROPDMGEXP <- toupper(data$PROPDMGEXP)
data$CROPDMGEXP <- toupper(data$CROPDMGEXP)
data$prop <- data$PROPDMG * sapply(data$PROPDMGEXP, convert_exp)
data$crop <- data$CROPDMG * sapply(data$CROPDMGEXP, convert_exp)
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.5.3
##
## 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)
## Warning: package 'ggplot2' was built under R version 4.5.3
health <- data %>%
group_by(EVTYPE) %>%
summarise(total = sum(FATALITIES + INJURIES, na.rm = TRUE)) %>%
arrange(desc(total)) %>%
head(10)
health
## # A tibble: 10 × 2
## EVTYPE total
## <chr> <dbl>
## 1 TORNADO 96979
## 2 EXCESSIVE HEAT 8428
## 3 TSTM WIND 7461
## 4 FLOOD 7259
## 5 LIGHTNING 6046
## 6 HEAT 3037
## 7 FLASH FLOOD 2755
## 8 ICE STORM 2064
## 9 THUNDERSTORM WIND 1621
## 10 WINTER STORM 1527
economic <- data %>%
group_by(EVTYPE) %>%
summarise(total = sum(prop + crop, na.rm = TRUE)) %>%
arrange(desc(total)) %>%
head(10)
economic
## # A tibble: 10 × 2
## EVTYPE total
## <chr> <dbl>
## 1 FLOOD 150319678257
## 2 HURRICANE/TYPHOON 71913712800
## 3 TORNADO 57352114049.
## 4 STORM SURGE 43323541000
## 5 HAIL 18758221521.
## 6 FLASH FLOOD 17562129167.
## 7 DROUGHT 15018672000
## 8 HURRICANE 14610229010
## 9 RIVER FLOOD 10148404500
## 10 ICE STORM 8967041360
Tornadoes are the most harmful to population health due to the highest number of fatalities and injuries. Floods and hurricanes contribute the most to economic damage because of large-scale property and crop losses.
The figure below shows the top 10 weather event types that are most harmful to population health, based on total fatalities and injuries.
ggplot(health, aes(x = reorder(EVTYPE, total), y = total)) +
geom_bar(stat = "identity") +
coord_flip() +
ggtitle("Top Events Harmful to Population Health")
The figure below shows the top 10 weather event types that cause the greatest economic damage, based on total property and crop losses.
ggplot(economic, aes(x = reorder(EVTYPE, total), y = total)) +
geom_bar(stat = "identity") +
coord_flip() +
ggtitle("Top Events Economic Damage")