Disaster Research: Fatalities and Property Loss

getwd()
## [1] "/Users/janakiramsundaraneedi/Downloads"
setwd("/Users/janakiramsundaraneedi/Downloads")

Reproducible Research: Peer Assessment 1

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

Loading and preprocessing the data

storm_data <- read.csv("repdata-data-StormData.csv")
storm_data_needed <- storm_data[, c(8,23,24,25,27)]

Fatalities

Converting as.character to as.numeric Fatlitiesto numberic Value

storm_data_needed$FATALITIES <- as.numeric( as.character( storm_data_needed$FATALITIES ) )

Group the data by disaster type and summarizes it and filter the fatalities greater than 200 value.

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)

INJURIES

Converting as.character to as.numeric injuries to numberic Value

storm_data_needed$INJURIES <- as.numeric( as.character( storm_data_needed$INJURIES ) )

Group the data by disaster type and summarizes it and filter the injuries greater than 10000 value.

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)

PROPERTY DAMAGE

Converting as.character to as.numeric property damage to numberic Value

storm_data_needed$PROPDMG <- as.numeric( as.character( storm_data_needed$PROPDMG ) )

Group the data by property damage type and summarizes it and filter the property damage greater than $25000 value.

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)

CROP DAMAGE

Converting as.character to as.numeric crop damage to numberic Value

storm_data_needed$CROPDMG <- as.numeric( as.character( storm_data_needed$CROPDMG ) )

Group the data by crop damage type and summarizes it and filter the crop damage greater than $50000 value.

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)