This analysis explores the NOAA Storm Database to determine which weather events have the greatest impact on population health and economic damage in the United States. The analysis uses fatalities, injuries, property damage, and crop damage information from the database. Weather events were grouped by event type to calculate total health impacts and total economic consequences. Population health impact was measured using the combined number of fatalities and injuries. Economic impact was calculated by converting damage estimates into dollar values. The results identify the weather events that create the largest risks to communities.
The NOAA Storm Database was loaded directly from the raw CSV file provided for the assignment.
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)
storm <- read.csv("repdata_data_StormData1.csv")
dim(storm)
## [1] 902297 37
str(storm)
## 'data.frame': 902297 obs. of 37 variables:
## $ STATE__ : num 1 1 1 1 1 1 1 1 1 1 ...
## $ BGN_DATE : chr "4/18/1950 0:00:00" "4/18/1950 0:00:00" "2/20/1951 0:00:00" "6/8/1951 0:00:00" ...
## $ BGN_TIME : chr "0130" "0145" "1600" "0900" ...
## $ TIME_ZONE : chr "CST" "CST" "CST" "CST" ...
## $ COUNTY : num 97 3 57 89 43 77 9 123 125 57 ...
## $ COUNTYNAME: chr "MOBILE" "BALDWIN" "FAYETTE" "MADISON" ...
## $ STATE : chr "AL" "AL" "AL" "AL" ...
## $ EVTYPE : chr "TORNADO" "TORNADO" "TORNADO" "TORNADO" ...
## $ BGN_RANGE : num 0 0 0 0 0 0 0 0 0 0 ...
## $ BGN_AZI : chr "" "" "" "" ...
## $ BGN_LOCATI: chr "" "" "" "" ...
## $ END_DATE : chr "" "" "" "" ...
## $ END_TIME : chr "" "" "" "" ...
## $ COUNTY_END: num 0 0 0 0 0 0 0 0 0 0 ...
## $ COUNTYENDN: logi NA NA NA NA NA NA ...
## $ END_RANGE : num 0 0 0 0 0 0 0 0 0 0 ...
## $ END_AZI : chr "" "" "" "" ...
## $ END_LOCATI: chr "" "" "" "" ...
## $ LENGTH : num 14 2 0.1 0 0 1.5 1.5 0 3.3 2.3 ...
## $ WIDTH : num 100 150 123 100 150 177 33 33 100 100 ...
## $ F : int 3 2 2 2 2 2 2 1 3 3 ...
## $ MAG : num 0 0 0 0 0 0 0 0 0 0 ...
## $ FATALITIES: num 0 0 0 0 0 0 0 0 1 0 ...
## $ INJURIES : num 15 0 2 2 2 6 1 0 14 0 ...
## $ PROPDMG : num 25 2.5 25 2.5 2.5 2.5 2.5 2.5 25 25 ...
## $ PROPDMGEXP: chr "K" "K" "K" "K" ...
## $ CROPDMG : num 0 0 0 0 0 0 0 0 0 0 ...
## $ CROPDMGEXP: chr "" "" "" "" ...
## $ WFO : chr "" "" "" "" ...
## $ STATEOFFIC: chr "" "" "" "" ...
## $ ZONENAMES : chr "" "" "" "" ...
## $ LATITUDE : num 3040 3042 3340 3458 3412 ...
## $ LONGITUDE : num 8812 8755 8742 8626 8642 ...
## $ LATITUDE_E: num 3051 0 0 0 0 ...
## $ LONGITUDE_: num 8806 0 0 0 0 ...
## $ REMARKS : chr "" "" "" "" ...
## $ REFNUM : num 1 2 3 4 5 6 7 8 9 10 ...
The variables used in this analysis are:
EVTYPE: weather event typeFATALITIES: number of fatalitiesINJURIES: number of injuriesPROPDMG: property damage estimatePROPDMGEXP: property damage multiplierCROPDMG: crop damage estimateCROPDMGEXP: crop damage multiplierThe health impact of each event type was calculated by adding fatalities and injuries.
health <- storm %>%
group_by(EVTYPE) %>%
summarise(
fatalities = sum(FATALITIES),
injuries = sum(INJURIES),
total_health = fatalities + injuries
) %>%
arrange(desc(total_health))
## `summarise()` ungrouping output (override with `.groups` argument)
head(health)
## # A tibble: 6 x 4
## EVTYPE fatalities injuries total_health
## <chr> <dbl> <dbl> <dbl>
## 1 TORNADO 5633 91346 96979
## 2 EXCESSIVE HEAT 1903 6525 8428
## 3 TSTM WIND 504 6957 7461
## 4 FLOOD 470 6789 7259
## 5 LIGHTNING 816 5230 6046
## 6 HEAT 937 2100 3037
The damage exponent variables were converted into dollar multipliers.
damage_multiplier <- function(x) {
x <- toupper(x)
ifelse(x == "K", 1000,
ifelse(x == "M", 1000000,
ifelse(x == "B", 1000000000,
1)))
}
storm$PROP_DAMAGE <- storm$PROPDMG *
damage_multiplier(storm$PROPDMGEXP)
storm$CROP_DAMAGE <- storm$CROPDMG *
damage_multiplier(storm$CROPDMGEXP)
storm$TOTAL_DAMAGE <- storm$PROP_DAMAGE +
storm$CROP_DAMAGE
The total economic damage was calculated by event type.
economic <- storm %>%
group_by(EVTYPE) %>%
summarise(
total_damage = sum(TOTAL_DAMAGE)
) %>%
arrange(desc(total_damage))
## `summarise()` ungrouping output (override with `.groups` argument)
head(economic)
## # A tibble: 6 x 2
## EVTYPE total_damage
## <chr> <dbl>
## 1 FLOOD 150319678257
## 2 HURRICANE/TYPHOON 71913712800
## 3 TORNADO 57352114049.
## 4 STORM SURGE 43323541000
## 5 HAIL 18758221521.
## 6 FLASH FLOOD 17562129167.
The following figure shows the top 10 event types based on the combined number of fatalities and injuries.
top_health <- health[1:10,]
ggplot(top_health,
aes(x=reorder(EVTYPE,total_health),
y=total_health)) +
geom_bar(stat="identity") +
coord_flip() +
labs(
title="Top 10 Weather Events by Population Health Impact",
x="Event Type",
y="Fatalities and Injuries"
)
The figure shows which event types have produced the greatest human health consequences across the United States.
The following figure shows the top 10 event types ranked by total economic damage.
top_economic <- economic[1:10,]
ggplot(top_economic,
aes(x=reorder(EVTYPE,total_damage),
y=total_damage)) +
geom_bar(stat="identity") +
coord_flip() +
labs(
title="Top 10 Weather Events by Economic Damage",
x="Event Type",
y="Total Damage (US Dollars)"
)
The figure shows which severe weather events have caused the largest economic losses.
The NOAA Storm Database analysis identifies the weather events responsible for the largest impacts on human health and economic losses. Events with high fatalities and injuries represent major public safety concerns. Events with large property and crop damage represent significant economic challenges for communities.