This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.
This analysis uses the NOAA Storm Database to examine the effects of severe weather events across the United States. Two types of consequences are investigated: population health and economic damage. Population health impacts are measured using fatalities and injuries. Economic consequences are measured using property and crop damage. The data were loaded directly from the raw CSV file and processed in R. For population health, the event types were grouped and compared according to their total fatalities and injuries. For economic consequences, property and crop damage were converted to dollar amounts using the corresponding exponent fields. The results show that tornadoes had the largest combined number of fatalities and injuries, while floods had the largest combined property and crop damage in the analysis.
The NOAA Storm Database was loaded directly from the raw CSV file provided for the analysis. The data were then processed in R to investigate population health and economic consequences of severe weather events.
storm <- read.csv("repdata_data_StormData1.csv")
dim(storm)
## [1] 902297 37
head(storm)
## STATE__ BGN_DATE BGN_TIME TIME_ZONE COUNTY COUNTYNAME STATE EVTYPE
## 1 1 4/18/1950 0:00:00 0130 CST 97 MOBILE AL TORNADO
## 2 1 4/18/1950 0:00:00 0145 CST 3 BALDWIN AL TORNADO
## 3 1 2/20/1951 0:00:00 1600 CST 57 FAYETTE AL TORNADO
## 4 1 6/8/1951 0:00:00 0900 CST 89 MADISON AL TORNADO
## 5 1 11/15/1951 0:00:00 1500 CST 43 CULLMAN AL TORNADO
## 6 1 11/15/1951 0:00:00 2000 CST 77 LAUDERDALE AL TORNADO
## BGN_RANGE BGN_AZI BGN_LOCATI END_DATE END_TIME COUNTY_END COUNTYENDN
## 1 0 0 NA
## 2 0 0 NA
## 3 0 0 NA
## 4 0 0 NA
## 5 0 0 NA
## 6 0 0 NA
## END_RANGE END_AZI END_LOCATI LENGTH WIDTH F MAG FATALITIES INJURIES PROPDMG
## 1 0 14.0 100 3 0 0 15 25.0
## 2 0 2.0 150 2 0 0 0 2.5
## 3 0 0.1 123 2 0 0 2 25.0
## 4 0 0.0 100 2 0 0 2 2.5
## 5 0 0.0 150 2 0 0 2 2.5
## 6 0 1.5 177 2 0 0 6 2.5
## PROPDMGEXP CROPDMG CROPDMGEXP WFO STATEOFFIC ZONENAMES LATITUDE LONGITUDE
## 1 K 0 3040 8812
## 2 K 0 3042 8755
## 3 K 0 3340 8742
## 4 K 0 3458 8626
## 5 K 0 3412 8642
## 6 K 0 3450 8748
## LATITUDE_E LONGITUDE_ REMARKS REFNUM
## 1 3051 8806 1
## 2 0 0 2
## 3 0 0 3
## 4 0 0 4
## 5 0 0 5
## 6 0 0 6
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
health <- storm %>%
group_by(EVTYPE) %>%
summarise(
fatalities = sum(FATALITIES, na.rm = TRUE),
injuries = sum(INJURIES, na.rm = TRUE)
) %>%
mutate(
total_health = fatalities + injuries
) %>%
arrange(desc(total_health))
## `summarise()` ungrouping output (override with `.groups` argument)
The ten event types with the largest combined number of fatalities and injuries are shown below.
knitr::kable(
head(health, 10),
caption = "Top 10 Severe Weather Events by Population Health Impact"
)
| EVTYPE | fatalities | injuries | total_health |
|---|---|---|---|
| TORNADO | 5633 | 91346 | 96979 |
| EXCESSIVE HEAT | 1903 | 6525 | 8428 |
| TSTM WIND | 504 | 6957 | 7461 |
| FLOOD | 470 | 6789 | 7259 |
| LIGHTNING | 816 | 5230 | 6046 |
| HEAT | 937 | 2100 | 3037 |
| FLASH FLOOD | 978 | 1777 | 2755 |
| ICE STORM | 89 | 1975 | 2064 |
| THUNDERSTORM WIND | 133 | 1488 | 1621 |
| WINTER STORM | 206 | 1321 | 1527 |
Economic consequences were measured using property damage and crop damage. The NOAA Storm Database records the damage amount in PROPDMG and CROPDMG, while PROPDMGEXP and CROPDMGEXP indicate the magnitude of the reported damage.
The exponent values were converted to numerical multipliers. K and k represent thousands, M and m represent millions, B represents billions, and H and h represent hundreds. Numeric values were interpreted as powers of ten. Ambiguous values were assigned a multiplier of 1.
storm <- storm %>%
mutate(
prop_multiplier = case_when(
PROPDMGEXP %in% c("", "-", "+", "?", "0") ~ 10^0,
PROPDMGEXP == "1" ~ 10^1,
PROPDMGEXP == "2" ~ 10^2,
PROPDMGEXP %in% c("3", "K") ~ 10^3,
PROPDMGEXP == "4" ~ 10^4,
PROPDMGEXP == "5" ~ 10^5,
PROPDMGEXP %in% c("6", "M", "m") ~ 10^6,
PROPDMGEXP == "7" ~ 10^7,
PROPDMGEXP == "8" ~ 10^8,
PROPDMGEXP %in% c("H", "h") ~ 10^2,
PROPDMGEXP == "B" ~ 10^9,
TRUE ~ 1
),
crop_multiplier = case_when(
CROPDMGEXP %in% c("", "?") ~ 10^0,
CROPDMGEXP == "0" ~ 10^0,
CROPDMGEXP %in% c("2") ~ 10^2,
CROPDMGEXP %in% c("K", "k") ~ 10^3,
CROPDMGEXP %in% c("M", "m") ~ 10^6,
CROPDMGEXP == "B" ~ 10^9,
TRUE ~ 1
),
property_damage = PROPDMG * prop_multiplier,
crop_damage = CROPDMG * crop_multiplier,
total_damage = property_damage + crop_damage
)
We then aggregate the damage by event type:
economic <- storm %>%
group_by(EVTYPE) %>%
summarise(
property_damage = sum(property_damage, na.rm = TRUE),
crop_damage = sum(crop_damage, na.rm = TRUE),
total_damage = sum(total_damage, na.rm = TRUE)
) %>%
arrange(desc(total_damage))
## `summarise()` ungrouping output (override with `.groups` argument)
knitr::kable(
head(economic, 10),
caption = "Top 10 Severe Weather Events by Economic Damage"
)
| EVTYPE | property_damage | crop_damage | total_damage |
|---|---|---|---|
| FLOOD | 144657709807 | 5661968450 | 150319678257 |
| HURRICANE/TYPHOON | 69305840000 | 2607872800 | 71913712800 |
| TORNADO | 56947380676 | 414953270 | 57362333946 |
| STORM SURGE | 43323536000 | 5000 | 43323541000 |
| HAIL | 15735267513 | 3025954473 | 18761221986 |
| FLASH FLOOD | 16822673978 | 1421317100 | 18243991078 |
| DROUGHT | 1046106000 | 13972566000 | 15018672000 |
| HURRICANE | 11868319010 | 2741910000 | 14610229010 |
| RIVER FLOOD | 5118945500 | 5029459000 | 10148404500 |
| ICE STORM | 3944927860 | 5022113500 | 8967041360 |
Population health impacts were assessed using the total number of fatalities and injuries associated with each event type. The analysis shows that tornadoes had the largest overall impact, with 5,633 fatalities and 91,346 injuries, for a combined total of 96,979. Excessive heat was the second-largest contributor to the combined total, with 1,903 fatalities and 6,525 injuries. Other event types with substantial population health impacts included thunderstorm winds, floods, and lightning. The results indicate that the population health burden varies considerably across different types of severe weather events.
library(ggplot2)
health_top <- health %>%
slice_max(order_by = total_health, n = 10)
ggplot(health_top,
aes(x = reorder(EVTYPE, total_health),
y = total_health)) +
geom_col(fill = "steelblue") +
coord_flip() +
labs(
title = "Top 10 Severe Weather Events by Population Health Impact",
x = "Event Type",
y = "Fatalities + Injuries"
) +
theme_minimal()
The results indicate substantial variation in economic consequences among severe weather event types. Floods had the largest combined property and crop damage, totaling approximately $150.3 billion. Hurricanes and typhoons followed with approximately $71.9 billion, while tornadoes accounted for approximately $57.4 billion.
economic_top <- economic %>%
slice_max(order_by = total_damage, n = 10)
ggplot(economic_top,
aes(x = reorder(EVTYPE, total_damage),
y = total_damage)) +
geom_col(fill = "darkgreen") +
coord_flip() +
labs(
title = "Top 10 Severe Weather Events by Economic Damage",
x = "Event Type",
y = "Total Damage (US dollars)"
) +
theme_minimal()