This analysis uses U.S. National Oceanic and Atmospheric Administration (NOAA) storm data to explore the effects of weather events in the US. We identify events most harmful to population health and those causing the greatest economic damages. By analyzing data from 1950 to 2011, we provide insights for resource prioritization and preparedness.
For this analysis, the following packages were used:
library(dplyr)
library(ggplot2)
library(gridExtra)
The dataset used in this analysis is the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database, which tracks characteristics of major storms and weather events in the United States between 1950 and November 2011. The raw dataset was provided as a compressed .csv.bz2 file and contains data on weather event types (EVTYPE), human impacts (FATALITIES, INJURIES), and economic impacts (PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP).
The dataset was loaded into R directly from the compressed file using the read.csv() function.
# Load the data
storm_data <- read.csv("repdata_data_StormData.csv")
# Preview data
str(storm_data)
## '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 ...
Only the variables related to event type, fatalities, injuries, property and crop damage were retained to reduce memory use and focus the analysis.
# Select relevant variables
storm <- storm_data %>%
select(EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)
To evaluate which types of weather events have the greatest economic consequences, the following data transformation and analysis steps were performed:
To identify which types of severe weather events were most harmful to population health, the data was processed as follows:
Grouping by Event Type: The dataset was grouped by the EVTYPE variable, which categorizes different storm and weather events (e.g., tornado, flood, lightning).
Summarizing Fatalities and Injuries: For each event type, the total number of fatalities (FATALITIES) and injuries (INJURIES) was computed using sum(…, na.rm = TRUE) to ensure missing values did not interfere with the calculations.
Calculating Total Health Impact: A new variable, Total, was created by adding the total fatalities and injuries for each event type. This provided a unified measure of the overall impact of each weather event on population health.
Sorting and Selecting Top Events: The data was arranged in descending order based on the Total health impact. The top_n(10, Total) function was used to retain only the top 10 most harmful event types.
Visualization Preparation: The resulting dataset (health_impact) was used to create a horizontal bar chart to visually display and compare the top 10 most harmful events.
To evaluate which types of weather events have the greatest economic consequences, the following data transformation steps were performed:
Understanding Damage Exponents: In the original dataset, the PROPDMGEXP and CROPDMGEXP columns represent the units of property and crop damage costs, respectively. These values are encoded as characters such as “K” (thousands), “M” (millions), and “B” (billions), or occasionally as numeric characters or other symbols. To accurately compute monetary values, these exponent codes had to be converted to numeric multipliers.
Creating a Conversion Function: A custom function named convert_exp() was defined to map each exponent to its corresponding numeric multiplier:
All other or unknown values were defaulted to 1 to minimize data loss
Applying the Conversion: The PROPDMGEXP and CROPDMGEXP columns were first converted to character type and then passed through the convert_exp() function using sapply() to generate new numeric multiplier columns.
Calculating Actual Damage Costs
New columns were then created using mutate():
This processing ensured that the economic impact of each weather event was accurately quantified in dollars and could be reliably analyzed and compared across event types.
# Convert damage exponents to numeric values
convert_exp <- function(e) {
if (e %in% c('K', 'k')) return(1e3)
if (e %in% c('M', 'm')) return(1e6)
if (e %in% c('B', 'b')) return(1e9)
if (grepl("^[0-9]$", e)) return(10^as.numeric(e))
return(1)
}
storm$PROPDMGEXP <- sapply(as.character(storm$PROPDMGEXP), convert_exp)
storm$CROPDMGEXP <- sapply(as.character(storm$CROPDMGEXP), convert_exp)
storm <- storm %>%
mutate(
PROP_COST = PROPDMG * PROPDMGEXP,
CROP_COST = CROPDMG * CROPDMGEXP,
TOTAL_COST = PROP_COST + CROP_COST
)
This section summarizes the most significant findings on storm-related impacts across the United States from 1950 to 2011.
The analysis reveals that tornadoes are by far the most harmful weather events in terms of human health, causing the highest combined number of fatalities and injuries. Other impactful events include excessive heat, floods, and lightning.
health_impact <- storm %>%
group_by(EVTYPE) %>%
summarise(
Fatalities = sum(FATALITIES, na.rm = TRUE),
Injuries = sum(INJURIES, na.rm = TRUE)
) %>%
mutate(Total = Fatalities + Injuries) %>%
arrange(desc(Total)) %>%
top_n(10, Total)
# Plot
ggplot(health_impact, aes(reorder(EVTYPE, -Total), Total)) +
geom_bar(stat = "identity", fill = "tomato") +
coord_flip() +
labs(title = "Top 10 Events Most Harmful to Health", x = "Event Type", y = "Fatalities + Injuries")
Figure 1. Top 10 Weather Event Types Causing the Greatest Total Health Impact (Fatalities + Injuries)
This bar chart shows the top 10 event types based on the combined number of fatalities and injuries. Tornadoes are clearly the most harmful event type.
In terms of economic impact, floods cause the most damage overall, followed by hurricanes/typhoons, tornadoes, and storm surges. These events result in billions of dollars in property and crop damage.
economic_impact <- storm %>%
group_by(EVTYPE) %>%
summarise(TotalCost = sum(TOTAL_COST, na.rm = TRUE)) %>%
arrange(desc(TotalCost)) %>%
top_n(10, TotalCost)
ggplot(economic_impact, aes(reorder(EVTYPE, -TotalCost), TotalCost / 1e9)) +
geom_bar(stat = "identity", fill = "steelblue") +
coord_flip() +
labs(title = "Top 10 Events with Greatest Economic Damage", x = "Event Type", y = "Total Damage (Billion USD)")
Figure 2. Top 10 Weather Event Types Causing the Greatest Economic Damage
This plot displays the top 10 weather event types ranked by the total estimated cost of property and crop damage in USD. Floods and hurricanes are the most economically devastating.