Synopsis:

The analysis of the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database reveals critical insights into severe weather events. By examining the data from 1950 to 2011, we aimed to identify the types of events that are most harmful to population health and have the greatest economic consequences. Our analysis focused on total fatalities, injuries, and property damage for each event type (EVTYPE).

Data Processing

Set the URL for the data file

url <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"

Download the file

download.file(url, destfile = "StormData.csv.bz2")

Load the data into R

storm_data <- read.csv(bzfile("StormData.csv.bz2"))

Check the structure of the data

str(storm_data)

Load required packages

library(dplyr)

Data pre-processing

storm_data_clean <- storm_data %>% filter(!is.na(EVTYPE) & !is.na(FATALITIES) & !is.na(INJURIES) & !is.na(PROPDMG)) %>% mutate(PROPDMG = ifelse(grepl("K", PROPDMG, fixed = TRUE), as.numeric(sub("K", "", PROPDMG)) * 1000, ifelse(grepl("M", PROPDMG, fixed = TRUE), as.numeric(sub("M", "", PROPDMG)) * 1000000, as.numeric(PROPDMG))))

Results

Question 1: Most harmful events with respect to population health

events_population_health <- storm_data_clean %>% group_by(EVTYPE) %>% summarise(total_fatalities = sum(FATALITIES), total_injuries = sum(INJURIES)) %>% mutate(total_health_impact = total_fatalities + total_injuries) %>% arrange(desc(total_health_impact))

Question 2: Events with greatest economic consequences

events_economic_consequences <- storm_data_clean %>% group_by(EVTYPE) %>% summarise(total_property_damage = sum(PROPDMG)) %>% arrange(desc(total_property_damage))

Displaying the results

events_population_health events_economic_consequences

Load required packages

library(ggplot2)

Create bar plot for most harmful events with respect to population health

ggplot(head(events_population_health, 10), aes(x = reorder(EVTYPE, total_health_impact), y = total_health_impact)) + geom_bar(stat = "identity", fill = "skyblue") + labs(title = "Most Harmful Events with Respect to Population Health", x = "Event Type", y = "Total Health Impact") + theme(axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1))

Create bar plot for events with greatest economic consequences

ggplot(head(events_economic_consequences, 10), aes(x = reorder(EVTYPE, total_property_damage), y = total_property_damage)) + geom_bar(stat = "identity", fill = "lightgreen") + labs(title = "Events with Greatest Economic Consequences", x = "Event Type", y = "Total Property Damage") + theme(axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1))

I was curious about additional economic damages and below is the data pre-processing for additional economic damage variable

storm_data_clean <- storm_data %>% filter(!is.na(EVTYPE) & !is.na(FATALITIES) & !is.na(INJURIES) & !is.na(PROPDMG) & !is.na(CROPDMG)) %>% mutate(PROPDMG = ifelse(grepl("K", PROPDMG, fixed = TRUE), as.numeric(sub("K", "", PROPDMG)) * 1000, ifelse(grepl("M", PROPDMG, fixed = TRUE), as.numeric(sub("M", "", PROPDMG)) * 1000000, as.numeric(PROPDMG))), CROPDMG = ifelse(grepl("K", CROPDMG, fixed = TRUE), as.numeric(sub("K", "", CROPDMG)) * 1000, ifelse(grepl("M", CROPDMG, fixed = TRUE), as.numeric(sub("M", "", CROPDMG)) * 1000000, as.numeric(CROPDMG))))

Data analysis for additional economic damage variable

events_crop_damage <- storm_data_clean %>% group_by(EVTYPE) %>% summarise(total_crop_damage = sum(CROPDMG)) %>% arrange(desc(total_crop_damage))

Create bar plot for events with the next in line size of economic consequences

ggplot(head(events_crop_damage, 10), aes(x = reorder(EVTYPE, total_crop_damage), y = total_crop_damage)) + geom_bar(stat = "identity", fill = "coral") + labs(title = "Events with the Next in Line Size of Economic Consequences (Crop Damage)", x = "Event Type", y = "Total Crop Damage") + theme(axis.text.x = element_text(angle = 45, hjust = 1, vjust = 1))

As we can see crop is the next in line for major economic damage.

Conclusions:

From the Storm Data it is clearly appear that Tornado has the worst impact in both health and economic consequences. Interestingly the most damaging weather event to crop is Hail second by Flash Flood and Flood.