This report presents a data analysis from the NOOA for evaluation of the climate events with more dangerous effects to human health and property damages. Tha analysis shows that Tornado events presents the greates threats both for human life and property damage.
The code below process the raw data. The data can be downloaded at Raw Data Unzip the file after downloading.
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
setwd("~/Desktop")
file <- read.csv("repdata-data-StormData.csv")
data <- tbl_df(file)
# Events related to injuries and fatalities
health <- data %>%
select(EVTYPE, INJURIES, FATALITIES) %>%
group_by(EVTYPE) %>%
summarise(INJ = sum(INJURIES), FAT = sum(FATALITIES), Tot = (INJ + FAT)) %>%
arrange(desc(Tot))
# Events related to property damage in US$
damage <- data %>%
select(EVTYPE, PROPDMG) %>%
group_by(EVTYPE) %>%
summarise(DMG = sum(PROPDMG)) %>%
arrange(desc(DMG))
he <- head(health)
dm <- head(damage)
The plot below shows the Health and Property damage for the top events.
par(las=3)
barplot(he$Tot,
names.arg = he$EVTYPE,
size = 8,
horiz = FALSE,
col = "blue",
cex.names = 0.5,
main = "Injuries + Death by Event type")
## Warning in plot.window(xlim, ylim, log = log, ...): "size" is not a
## graphical parameter
## Warning in axis(if (horiz) 2 else 1, at = at.l, labels = names.arg, lty =
## axis.lty, : "size" is not a graphical parameter
## Warning in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...):
## "size" is not a graphical parameter
## Warning in axis(if (horiz) 1 else 2, cex.axis = cex.axis, ...): "size" is
## not a graphical parameter
barplot(dm$DMG,
names.arg = dm$EVTYPE,
horiz = FALSE,
col = "red",
cex.names = 0.5,
main = "Damage Events")