Davin Kaing
As part of Coursera Reproducible Research Course, this assigment explores the National Oceanic and Atmospheric Administration Storm Data. The data details the storm occurances, rare weather, or other meteorological events. The objective of this report is to answer the following questions: which types of events are most harmful to the population health and economy?
The data was first downloaded into the working directory called “Coursera.” The downloaded file was read into RStudio using ‘read.csv’ command.
setwd("/Users/davinkaing/Desktop/Coursera")
StormData <- read.csv("repdata-data-StormData (1).csv")
To find the event that caused the most harm to population health, the injuries and fatalities are summed with respect to the event type. This was done by using the ‘aggregate’ command.
INJ <- aggregate(INJURIES+FATALITIES~EVTYPE, data = StormData, FUN = sum)
Afterwards, the severity of the event are ranked by the most injuries and fatalities. The top events was saved to object, ‘TopEVT’. The column names were also changed for convenient plotting.
EVTordered <- INJ[order(INJ[,2], decreasing = TRUE),]
TopEVT <- EVTordered[1:10,]
colnames(TopEVT) <- c("EVTYPE", "INJFAT")
The methodology used to analyze the events most harmful to population health is also used to find the events that were most harmful to the economy. Here, the property damagaes were added to the cropping damages to measure the severity of economic harm.
ECON <- aggregate(PROPDMG+CROPDMG~EVTYPE, data = StormData, FUN = sum)
colnames(ECON) <- c("EVTYPE", "PROPCROP")
ECONorder <- ECON[order(ECON$PROPCROP, decreasing = TRUE),]
TopECON <- ECONorder[1:10,]
Table 1 depicts the 10 most harmful events that affected population health. Of these 10 events, Tornado caused the largest damage to population health.
barplot(TopEVT$INJFAT, col = heat.colors(12), main = "Table 1: Top 10 Events Most Harmful to Population Health",
ylab = "Number of Injuries and Fatalities", xlab = "Event Types")
legend("topright", legend = TopEVT$EVTYPE, fill = heat.colors(12), ncol = 2, cex = 0.55)
For the events that lead to the most harm in the economy, the following table (Table 2) shows the top 10 countries had the greatest amount of damages.
barplot(TopECON$PROPCROP, col = terrain.colors(12), main = "Table 2: Top 10 Events Most Harmful to Economy",
xlab = "Event Types", ylab = "Number of Damages")
legend("topright", legend = TopECON$EVTYPE, fill = terrain.colors(12), ncol = 2, cex = 0.55)