Synopsis

This report analyzes severe weather events in the United States using the NOAA Storm Database. The goal is to identify: 1. Which types of weather events are most harmful to population health. 2. Which types of weather events have the greatest economic consequences.

We use fatalities and injuries to assess public health impact and property and crop damage to evaluate financial losses. The dataset is processed in R, ensuring that all analysis starts from the raw data. Visualizations highlight the most impactful weather events.


# Load required libraries
library(dplyr)
library(ggplot2)

# Load the dataset from the raw CSV file
file_path <- "C:/Users/maria/OneDrive/Escritorio/R/Hopkins/Reproducible/repdata_data_StormData.csv"
storm_data <- read.csv(file_path, stringsAsFactors = FALSE)

# Select relevant columns for population health analysis
storm_health <- storm_data %>%
  select(EVTYPE, FATALITIES, INJURIES) %>%
  filter(FATALITIES > 0 | INJURIES > 0)  # Keep only events that caused harm

# Aggregate total fatalities and injuries per event type
health_impact <- storm_health %>%
  group_by(EVTYPE) %>%
  summarise(
    Total_Fatalities = sum(FATALITIES, na.rm = TRUE),
    Total_Injuries = sum(INJURIES, na.rm = TRUE),
    Total_Harm = Total_Fatalities + Total_Injuries
  ) %>%
  arrange(desc(Total_Harm))

# Visualization: Top 10 most harmful events
top_health_events <- head(health_impact, 10)

ggplot(top_health_events, aes(x = reorder(EVTYPE, -Total_Harm), y = Total_Harm, fill = Total_Fatalities)) +
  geom_bar(stat = "identity") +
  coord_flip() +
  labs(
    title = "Top 10 Most Harmful Weather Events in the US",
    x = "Event Type",
    y = "Total Harm (Fatalities + Injuries)",
    fill = "Fatalities"
  ) +
  theme_minimal()

# Select relevant columns for economic analysis
storm_econ <- storm_data %>%
  select(EVTYPE, PROPDMG, PROPDMGEXP, CROPDMG, CROPDMGEXP)

# Function to convert damage exponents correctly
convert_exponent <- function(exp) {
  exp <- toupper(exp)
  ifelse(exp == "H", 100,
         ifelse(exp == "K", 1e3,
                ifelse(exp == "M", 1e6,
                       ifelse(exp == "B", 1e9, 1))))
}

# Apply exponent conversion
storm_econ <- storm_econ %>%
  mutate(
    PROPDMGEXP = convert_exponent(PROPDMGEXP),
    CROPDMGEXP = convert_exponent(CROPDMGEXP),
    Total_Property_Damage = PROPDMG * PROPDMGEXP,
    Total_Crop_Damage = CROPDMG * CROPDMGEXP,
    Total_Economic_Impact = Total_Property_Damage + Total_Crop_Damage
  )

# Aggregate total economic impact per event type
economic_impact <- storm_econ %>%
  group_by(EVTYPE) %>%
  summarise(
    Total_Property_Damage = sum(Total_Property_Damage, na.rm = TRUE),
    Total_Crop_Damage = sum(Total_Crop_Damage, na.rm = TRUE),
    Total_Economic_Impact = sum(Total_Economic_Impact, na.rm = TRUE)
  ) %>%
  arrange(desc(Total_Economic_Impact))

# Visualization: Top 10 most economically damaging events
top_econ_events <- head(economic_impact, 10)

ggplot(top_econ_events, aes(x = reorder(EVTYPE, -Total_Economic_Impact), y = Total_Economic_Impact, fill = Total_Property_Damage)) +
  geom_bar(stat = "identity") +
  coord_flip() +
  labs(
    title = "Top 10 Weather Events with Greatest Economic Impact in the US",
    x = "Event Type",
    y = "Total Economic Impact (Property + Crop Damage in USD)",
    fill = "Property Damage"
  ) +
  theme_minimal()

# Final Conclusion
cat("
## **Final Conclusions**
This analysis provides **data-driven insights** into the impact of severe weather events in the United States:

✅ **Tornadoes** pose the highest **threat to human life and health**.  
✅ **Hurricanes, floods, and storm surges** cause **the greatest financial losses**.  
✅ **Droughts and hailstorms** heavily impact **agriculture and crop production**.  

### **Key Takeaways for Decision Makers**
- **Public health risk:** Tornadoes and excessive heat should be priority concerns for **emergency preparedness and response planning**.
- **Financial preparedness:** Hurricanes, floods, and storm surges lead to **massive economic losses**, requiring better **infrastructure resilience and disaster funding**.
- **Agricultural impact:** Droughts and hailstorms are particularly damaging to **crops**, affecting food supply and farming economies.

---

### **Next Steps**
- **Further analysis** could be conducted on specific time periods or regions.
- **Trend analysis** over the years could provide insights into whether weather-related disasters are becoming more severe.
- **Policy recommendations** could be developed based on these results.

This R Markdown document provides a **fully reproducible analysis** using the raw NOAA Storm Database.
")
## 
## ## **Final Conclusions**
## This analysis provides **data-driven insights** into the impact of severe weather events in the United States:
## 
## ✅ **Tornadoes** pose the highest **threat to human life and health**.  
## ✅ **Hurricanes, floods, and storm surges** cause **the greatest financial losses**.  
## ✅ **Droughts and hailstorms** heavily impact **agriculture and crop production**.  
## 
## ### **Key Takeaways for Decision Makers**
## - **Public health risk:** Tornadoes and excessive heat should be priority concerns for **emergency preparedness and response planning**.
## - **Financial preparedness:** Hurricanes, floods, and storm surges lead to **massive economic losses**, requiring better **infrastructure resilience and disaster funding**.
## - **Agricultural impact:** Droughts and hailstorms are particularly damaging to **crops**, affecting food supply and farming economies.
## 
## ---
## 
## ### **Next Steps**
## - **Further analysis** could be conducted on specific time periods or regions.
## - **Trend analysis** over the years could provide insights into whether weather-related disasters are becoming more severe.
## - **Policy recommendations** could be developed based on these results.
## 
## This R Markdown document provides a **fully reproducible analysis** using the raw NOAA Storm Database.