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.
Goal: This Analysis will show the rough side effects on weather. I am going to be processing the data
data <- "repdata_data_StormData.csv"
dataStorm <- read.csv(data,fill = TRUE,header = T)
I am processing the data
require(ggplot2)
## Loading required package: ggplot2
require(reshape2)
## Loading required package: reshape2
require(plyr)
## Loading required package: plyr
stormData <- as.data.frame(cbind(dataStorm$EVTYPE,dataStorm$FATALITIES+dataStorm$INJURIES))
names(stormData) <- c('EVENT.TYPE','fatalities.and.injuries')
stormData$EVENT.TYPE <- as.factor(stormData$EVENT.TYPE)
levels(stormData$EVENT.TYPE) <- levels(dataStorm$EVTYPE)
sum <- ddply(.data = stormData,.(EVENT.TYPE),summarize,sum(fatalities.and.injuries))
names(sum)[2] <- 'fatalities.and.injuries'
sum$EVENT.TYPE <- as.factor(sum$EVENT.TYPE)
levels(sum$EVENT.TYPE) <- levels(dataStorm$EVTYPE)
ord.sum <- sum[order(sum$fatalities.and.injuries,decreasing = T),]
avg <- mean(ord.sum$fatalities.and.injuries)
subS <- subset(ord.sum,fatalities.and.injuries>avg)
med <- median(unique(stormData$fatalities.and.injuries))
dataSub <- subset(stormData,fatalities.and.injuries>med)
We can see that depending on the event, the injuries and fatalities might be higher than others. Tornado has the highest injuries and fatalities for this data set.
ggplot(subS,aes(EVENT.TYPE,fatalities.and.injuries)) +
geom_point(aes(colour=EVENT.TYPE)) +
theme(legend.position="none",axis.text.x = element_text(angle = 45, hjust = 1)) +
ggtitle('fatilities and injuries from major disasters')
stormData <- as.data.frame(cbind(dataStorm$EVTYPE,dataStorm$PROPDMG+
dataStorm$CROPDMG))
names(stormData) <- c('Event.Type','economic.damages')
sum <- ddply(.data = stormData,.(Event.Type),summarize,sum(economic.damages))
names(sum)[2] <- "economic.damages"
sum$Event.Type <- as.factor(sum$Event.Type)
levels(sum$Event.Type) <- levels(dataStorm$EVTYPE)
ord.sum <- sum[order(sum$economic.damages,decreasing = T),]
avg <- mean(ord.sum$economic.damages)
subS <- subset(ord.sum,economic.damages>avg)
This shows the econmic damage for each of the storms. Tornado has the highest econmic cost.
ggplot(subS,aes(Event.Type,economic.damages)) +
geom_point(aes(colour=Event.Type)) +
theme(legend.position="none",axis.text.x = element_text(angle = 45, hjust = 1)) +
ggtitle('Economic damage caused by major disasters')