Storms and other severe weather events can cause both public health and economic problems for communities and municipalities. Many severe events can result in fatalities, injuries, and property damage, and preventing such outcomes to the extent possible is a key concern.
This project involves exploring the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database. This database tracks characteristics of major storms and weather events in the United States, including when and where they occur, as well as estimates of any fatalities, injuries, and property damage.
The analysis on the storm event database revealed that tornadoes are the most dangerous weather event to the population health. And Floods are the most costly weather event to economic consequences.
These library are required.
library(tidyr)
library(dplyr)
library(ggplot2)
## library(DescTools)
At first, Read the data into a data frame.
data <- read.csv("data/repdata_data_StormData.csv")
Then, before data processing, remove duplicated event types.
names(data) <- tolower(names(data))
## event_types <- gsub("[[:blank:][:punct:]+]", " ", event_types)
## storm$evtype <- event_types
Next, group the data by event types.
data <- group_by(data, evtype)
data2 <- summarize(data, sum(fatalities), sum(injuries))
names(data2) <- c("evtype","fatalities","injuries")
data3 <- gather(data2, impact_type, value, -evtype)
data3 <- arrange(data3, desc(value))
Across the United States,
which types of events are most harmful with respect to population health?
Filter data for events that caused more than 400 fatalities and injuries.
data3 <- filter(data3, value > 400)
Here is the plot result.
qplot(data=data3, x=value, y=evtype, fill=impact_type, color=impact_type, log="x",
main="Human impact",
xlab="Number of people",
ylab="Event Type")
Diagram shows,
Across the United States,
which types of events have the greatest economic consequences?
Filter data for event types that cause Billion $ impact. Sum up propety and corporate costs of events.
e2p <- filter(data, propdmgexp == "B" )
e2p <- group_by(e2p,evtype)
e2p <- summarise(e2p, cost=sum(propdmg))
e2c <- filter(data, cropdmgexp == "B" )
e2c <- group_by(e2c,evtype)
e2c <- summarise(e2c, cost=sum(cropdmg))
e2 <- rbind(e2p,e2c)
e2 <- group_by(e2,evtype)
e2 <- summarise(e2, cost=sum(cost))
e2 <- arrange(e2, desc(cost))
qplot(data=e2, x=cost, y=evtype, main="Economic impact", xlab="Cost in Billion $", ylab="Event Type" )
Diagram shows,