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 basic goal of this assignment is to explore the NOAA Storm Database and answer some basic questions about severe weather events. We must use the database to answer the questions below and show the code for your entire analysis. Our analysis can consist of tables, figures, or other summaries and filters.
EVTYPE: Events like Tornados, floods, cyclones.
FATALITIES: Comparing fatalities during disaster types. INJURIES: Injuries Ocurred during events type. PROPDMG : Property Damage.
CROPDMG : Crop Damage.
The data for this assignment come in the form of a comma-separated-value file compressed via the bzip2 algorithm to reduce its size.
if(!file.exists("./repdata_data_StormData.csv.bz2")){
file.create("./repdata_data_StormData.csv.bz2")
download.file("https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2",
"./repdata_data_StormData.csv.bz2")
}
storm<-read.csv("./repdata_data_StormData.csv.bz2", header=T)
Specify certain attributes for futher processing
storm_data_needed <- storm[, c(8,23,24,25,27)]
names(storm_data_needed)
## [1] "EVTYPE" "FATALITIES" "INJURIES" "PROPDMG" "CROPDMG"
dim(storm_data_needed)
## [1] 902297 5
#loading the required packages
library(ggplot2)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
#Converting as.character to numberic Value
storm_data_needed$FATALITIES <- as.numeric(storm_data_needed$FATALITIES )
fatal <- storm_data_needed %>%
group_by(EVTYPE) %>%
summarize(FATALITIES = sum(FATALITIES)) %>%
filter(FATALITIES>300)
#Plot the fatalities with point presentation
ggplot(fatal, aes(EVTYPE, FATALITIES)) + geom_point(size=3)
#loading the required packages
library(ggplot2)
library(dplyr)
#Converting as.character to numberic Value
storm_data_needed$INJURIES <- as.numeric( storm_data_needed$INJURIES )
injury <- storm_data_needed %>%
group_by(EVTYPE) %>%
summarize(INJURIES = sum(INJURIES)) %>%
filter(INJURIES>8000)
#Plot the injuries with point presentation
ggplot(injury, aes(EVTYPE, INJURIES)) + geom_point(size=3)
#loading the required packages
library(ggplot2)
library(dplyr)
#Converting as.character to numberic Value
storm_data_needed$PROPDMG <- as.numeric( storm_data_needed$PROPDMG )
property_damage_plot <- storm_data_needed %>%
group_by(EVTYPE) %>%
summarize(PROPDMG = sum(PROPDMG)) %>%
filter(PROPDMG > 25000)
#Plot the property damage with point presentation
ggplot(property_damage_plot, aes(EVTYPE, PROPDMG)) + geom_point(size=3)
#loading the required packages
library(ggplot2)
library(dplyr)
#Converting as.character to numberic Value
storm_data_needed$CROPDMG <- as.numeric(storm_data_needed$CROPDMG)
crop_damage_plot <- storm_data_needed %>%
group_by(EVTYPE) %>%
summarize(CROPDMG = sum(CROPDMG)) %>%
filter(CROPDMG > 50000)
#Plot the crop damage with point presentation
ggplot(crop_damage_plot, aes(EVTYPE, CROPDMG)) + geom_point(size=3)