Severe Weather Events Analysis

Synopsis

This analysis explores the NOAA Storm Database to identify the types of events that are most harmful with respect to population health and have the greatest economic consequences across the United States. The data processing includes loading and cleaning the raw CSV file, and the results are presented using tables and plots. The aim is to provide insights for government or municipal managers responsible for preparing for severe weather events.

Data Processing

Loading and Cleaning Data

# Load necessary libraries
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## âś” dplyr     1.1.4     âś” readr     2.1.4
## âś” forcats   1.0.0     âś” stringr   1.5.1
## âś” ggplot2   3.4.4     âś” tibble    3.2.1
## âś” lubridate 1.9.3     âś” tidyr     1.3.0
## âś” purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## âś– dplyr::filter() masks stats::filter()
## âś– dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
# Load the raw CSV file
storm_data <- read.csv("repdata_data_StormData.csv", stringsAsFactors = FALSE)

# Convert date and time columns to appropriate formats
storm_data$BGN_DATE <- as.POSIXct(storm_data$BGN_DATE, format = "%m/%d/%Y %H:%M:%S")
storm_data$END_DATE <- as.POSIXct(storm_data$END_DATE, format = "%m/%d/%Y %H:%M:%S")

# Drop unnecessary columns
storm_data <- select(storm_data, EVTYPE, FATALITIES, INJURIES, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)

Data Cleaning

# Convert damage values to numeric
storm_data$PROPDMG <- as.numeric(storm_data$PROPDMG) * 10^(as.numeric(storm_data$PROPDMGEXP))
## Warning: NAs introduced by coercion
storm_data$CROPDMG <- as.numeric(storm_data$CROPDMG) * 10^(as.numeric(storm_data$CROPDMGEXP))
## Warning: NAs introduced by coercion
# Drop EXP columns
storm_data <- select(storm_data, -ends_with("EXP"))

# Replace missing values with 0
storm_data[is.na(storm_data)] <- 0

Results

Most Harmful Events with Respect to Population Health

# Group by event type and sum the fatalities and injuries
harmful_events <- storm_data %>%
  group_by(EVTYPE) %>%
  summarize(total_fatalities = sum(FATALITIES), total_injuries = sum(INJURIES)) %>%
  arrange(desc(total_fatalities + total_injuries))

# Display the top 10 harmful events
head(harmful_events, 10)
## # A tibble: 10 Ă— 3
##    EVTYPE            total_fatalities total_injuries
##    <chr>                        <dbl>          <dbl>
##  1 TORNADO                       5633          91346
##  2 EXCESSIVE HEAT                1903           6525
##  3 TSTM WIND                      504           6957
##  4 FLOOD                          470           6789
##  5 LIGHTNING                      816           5230
##  6 HEAT                           937           2100
##  7 FLASH FLOOD                    978           1777
##  8 ICE STORM                       89           1975
##  9 THUNDERSTORM WIND              133           1488
## 10 WINTER STORM                   206           1321

Events with the Greatest Economic Consequences

# Group by event type and sum the property and crop damages
economic_consequences <- storm_data %>%
  group_by(EVTYPE) %>%
  summarize(total_property_damage = sum(PROPDMG), total_crop_damage = sum(CROPDMG)) %>%
  arrange(desc(total_property_damage + total_crop_damage))

# Display the top 10 events with economic consequences
head(economic_consequences, 10)
## # A tibble: 10 Ă— 3
##    EVTYPE             total_property_damage total_crop_damage
##    <chr>                              <dbl>             <dbl>
##  1 FLASH FLOOD                   681862262.                 0
##  2 THUNDERSTORM WINDS            208635808.                80
##  3 TORNADO                        10220134.               160
##  4 HAIL                            3000236.                20
##  5 LIGHTNING                       1720146.                 0
##  6 FLOODING                         591000                  0
##  7 HEAVY SNOW                       170000                  0
##  8 FLOOD/FLASH FLOOD                 22007                  0
##  9 THUNDERSTORM WIND                  1330                  0
## 10 HIGH TIDES                          150                  0

Plot: Top 10 Events with Economic Consequences

# Create a bar plot for the top 10 events with economic consequences
economic_consequences %>%
  slice_max(order_by = total_property_damage + total_crop_damage, n = 10) %>%
  pivot_longer(cols = starts_with("total"), names_to = "Damage Type", values_to = "Total Damage") %>%
  ggplot(aes(x = EVTYPE, y = `Total Damage`, fill = `Damage Type`)) +
  geom_bar(stat = "identity", position = "dodge") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  facet_wrap(~`Damage Type`, scales = "free_y", ncol = 2) +
  labs(title = "Top 10 Events with Economic Consequences",
       x = "Event Type",
       y = "Total Damage")

The bar plot above illustrates the top 10 severe weather events with the greatest economic consequences, considering both property and crop damages.


This analysis provides insights into severe weather events’ impact on population health and economic consequences. The tables highlight the types of events that cause the most harm, while the plot visualizes the economic consequences of different events. These findings can assist government or municipal managers in prioritizing resources for preparedness and response efforts.