Synopsis

Analysis of the NOAA Storm Database to identify which severe weather events are most harmful to population health and have the greatest economic consequences. Process raw data and aggregated fatalities, injuries, and property damage by event type. Results indicate that tornadoes are the most harmful to health, while floods cause the highest economic damage.

Data Processing

Load the raw data. Use bzfile to read the compressed data

# Load the raw data
raw_data <- read.csv(bzfile("repdata_data_StormData.csv.bz2"))
# Health Data
health_data <- aggregate(cbind(FATALITIES, INJURIES) ~ EVTYPE, data = raw_data, sum)
health_data$TOTAL_HARM <- health_data$FATALITIES + health_data$INJURIES
health_top <- head(health_data[order(-health_data$TOTAL_HARM), ], 5)

# Economic Data
econ_data <- aggregate(cbind(PROPDMG, CROPDMG) ~ EVTYPE, data = raw_data, sum)
econ_data$TOTAL_DMG <- econ_data$PROPDMG + econ_data$CROPDMG
econ_top <- head(econ_data[order(-econ_data$TOTAL_DMG), ], 5)
par(mfrow=c(2,1), mar=c(4,4,2,1))

# Plot 1: Health
barplot(health_top$TOTAL_HARM, names.arg=health_top$EVTYPE, 
        main="Top 5 Events: Public Health Impact", ylab="Total Casualties", col="red")

# Plot 2: Economy
barplot(econ_top$TOTAL_DMG, names.arg=econ_top$EVTYPE, 
        main="Top 5 Events: Economic Consequences", ylab="Total Damage", col="green")