####Synopsis The data were loaded into R directly from the .bz2 file. A few adjustments had be made to the dataset, namely: the Date columns were reclassed as ‘date’ vectors, STATE and event type (EVTYPE) were turned into factors, and a new column was created just for the year of the event. Subsets were selected from the main dataset grouping event type, and summing fatalities, injuries, property damage, and crop damage for each event type, and the same process was done but grouping and summing within years. With these subsets, I determined the events that were most responsible for each of these categories of human impact, and which years were most destructive. Looking at the composite graphs in figure 1, there are clearly one event that stands out in each, and sometimes a secondary event. Table 2 summarizes which events were most impactful for each category of human impact. Tornados are easily the most costly event for three out of the four categories accounting for 37% of fatalities, 65% of injuries, 30% of property damage. Hail comes in first for crop damage accounting for 42%. Finally, I graphed the amount of damage per year for each category (figure 2) and it’s clear that there’s a significant uptick in damage starting in the mid 1990s, and continuing through to the present.
####Set Environment:
# install.packages("knitr")
# install.packages("lubridate")
# install.packages("ggplot2")
# install.packages("dplyr")
#library(knitr)
#library(lubridate)
#library(ggplot2)
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.1.1
##
## 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
####Import data
setwd("C:/Users/tsant/Documents/Data Science/R_Training/05_Reproducibility/Rep_Data_PeerAssessment2_NOAA")
download.file("https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2", destfile = "repdata_data_StormData.csv.bz2", mode = "w")
noaa <- read.table("repdata%2Fdata%2FStormData.csv.bz2", header = T, sep = ",")
Look at data:
dim(noaa)
## [1] 902297 37
head(noaa)
## STATE__ BGN_DATE BGN_TIME TIME_ZONE COUNTY COUNTYNAME STATE EVTYPE
## 1 1 4/18/1950 0:00:00 0130 CST 97 MOBILE AL TORNADO
## 2 1 4/18/1950 0:00:00 0145 CST 3 BALDWIN AL TORNADO
## 3 1 2/20/1951 0:00:00 1600 CST 57 FAYETTE AL TORNADO
## 4 1 6/8/1951 0:00:00 0900 CST 89 MADISON AL TORNADO
## 5 1 11/15/1951 0:00:00 1500 CST 43 CULLMAN AL TORNADO
## 6 1 11/15/1951 0:00:00 2000 CST 77 LAUDERDALE AL TORNADO
## BGN_RANGE BGN_AZI BGN_LOCATI END_DATE END_TIME COUNTY_END COUNTYENDN
## 1 0 0 NA
## 2 0 0 NA
## 3 0 0 NA
## 4 0 0 NA
## 5 0 0 NA
## 6 0 0 NA
## END_RANGE END_AZI END_LOCATI LENGTH WIDTH F MAG FATALITIES INJURIES PROPDMG
## 1 0 14.0 100 3 0 0 15 25.0
## 2 0 2.0 150 2 0 0 0 2.5
## 3 0 0.1 123 2 0 0 2 25.0
## 4 0 0.0 100 2 0 0 2 2.5
## 5 0 0.0 150 2 0 0 2 2.5
## 6 0 1.5 177 2 0 0 6 2.5
## PROPDMGEXP CROPDMG CROPDMGEXP WFO STATEOFFIC ZONENAMES LATITUDE LONGITUDE
## 1 K 0 3040 8812
## 2 K 0 3042 8755
## 3 K 0 3340 8742
## 4 K 0 3458 8626
## 5 K 0 3412 8642
## 6 K 0 3450 8748
## LATITUDE_E LONGITUDE_ REMARKS REFNUM
## 1 3051 8806 1
## 2 0 0 2
## 3 0 0 3
## 4 0 0 4
## 5 0 0 5
## 6 0 0 6
str(noaa)
## 'data.frame': 902297 obs. of 37 variables:
## $ STATE__ : num 1 1 1 1 1 1 1 1 1 1 ...
## $ BGN_DATE : chr "4/18/1950 0:00:00" "4/18/1950 0:00:00" "2/20/1951 0:00:00" "6/8/1951 0:00:00" ...
## $ BGN_TIME : chr "0130" "0145" "1600" "0900" ...
## $ TIME_ZONE : chr "CST" "CST" "CST" "CST" ...
## $ COUNTY : num 97 3 57 89 43 77 9 123 125 57 ...
## $ COUNTYNAME: chr "MOBILE" "BALDWIN" "FAYETTE" "MADISON" ...
## $ STATE : chr "AL" "AL" "AL" "AL" ...
## $ EVTYPE : chr "TORNADO" "TORNADO" "TORNADO" "TORNADO" ...
## $ BGN_RANGE : num 0 0 0 0 0 0 0 0 0 0 ...
## $ BGN_AZI : chr "" "" "" "" ...
## $ BGN_LOCATI: chr "" "" "" "" ...
## $ END_DATE : chr "" "" "" "" ...
## $ END_TIME : chr "" "" "" "" ...
## $ COUNTY_END: num 0 0 0 0 0 0 0 0 0 0 ...
## $ COUNTYENDN: logi NA NA NA NA NA NA ...
## $ END_RANGE : num 0 0 0 0 0 0 0 0 0 0 ...
## $ END_AZI : chr "" "" "" "" ...
## $ END_LOCATI: chr "" "" "" "" ...
## $ LENGTH : num 14 2 0.1 0 0 1.5 1.5 0 3.3 2.3 ...
## $ WIDTH : num 100 150 123 100 150 177 33 33 100 100 ...
## $ F : int 3 2 2 2 2 2 2 1 3 3 ...
## $ MAG : num 0 0 0 0 0 0 0 0 0 0 ...
## $ FATALITIES: num 0 0 0 0 0 0 0 0 1 0 ...
## $ INJURIES : num 15 0 2 2 2 6 1 0 14 0 ...
## $ PROPDMG : num 25 2.5 25 2.5 2.5 2.5 2.5 2.5 25 25 ...
## $ PROPDMGEXP: chr "K" "K" "K" "K" ...
## $ CROPDMG : num 0 0 0 0 0 0 0 0 0 0 ...
## $ CROPDMGEXP: chr "" "" "" "" ...
## $ WFO : chr "" "" "" "" ...
## $ STATEOFFIC: chr "" "" "" "" ...
## $ ZONENAMES : chr "" "" "" "" ...
## $ LATITUDE : num 3040 3042 3340 3458 3412 ...
## $ LONGITUDE : num 8812 8755 8742 8626 8642 ...
## $ LATITUDE_E: num 3051 0 0 0 0 ...
## $ LONGITUDE_: num 8806 0 0 0 0 ...
## $ REMARKS : chr "" "" "" "" ...
## $ REFNUM : num 1 2 3 4 5 6 7 8 9 10 ...
####Data Processing * Turn date vectors into Date Class * Turn state and event type in to factors * Consolidate dates into years
noaa$BGN_DATE <- as.POSIXct(noaa$BGN_DATE, format = "%m/%d/%Y %H:%M:%S")
noaa$END_DATE <- as.POSIXct(noaa$END_DATE, format = "%m/%d/%Y %H:%M:%S")
noaa$STATE <- as.factor(noaa$STATE)
noaa$EVTYPE <- as.factor(noaa$EVTYPE)
noaa$YEARS <- format(noaa$BGN_DATE, format = "%Y")
######Make subset dataframes * gevent - grouped by event, sum the number of fatailites, injuries, property and crop damage * gyears - grouped by year, sum the number of fatailites, injuries, property and crop damage
gevent <- noaa %>% group_by(EVTYPE) %>% summarize(sumfate = sum(FATALITIES),
suminj = sum(INJURIES), sumprop = sum(PROPDMG), sumcrop = sum(CROPDMG))
#gevent stands for grouped event
gyears <- noaa %>% group_by(YEARS) %>% summarize(sumfate = sum(FATALITIES),
suminj = sum(INJURIES), sumprop = sum(PROPDMG), sumcrop = sum(CROPDMG))
#gyears stands for grouped years.
isna <- which(is.na(gevent$sumfate))
length(isna)
## [1] 0
isna
## integer(0)
isna <- which(is.na(gevent$suminj))
length(isna)
## [1] 0
isna
## integer(0)
isna <- which(is.na(gevent$sumprop))
length(isna)
## [1] 0
isna
## integer(0)
isna <- which(is.na(gevent$sumcrop))
length(isna)
## [1] 0
isna
## integer(0)
UQEVTYPE <- unique(noaa$EVTYPE)
length(UQEVTYPE)
## [1] 985
dim(gevent)
## [1] 985 5
head(gevent)
## # A tibble: 6 x 5
## EVTYPE sumfate suminj sumprop sumcrop
## <fct> <dbl> <dbl> <dbl> <dbl>
## 1 " HIGH SURF ADVISORY" 0 0 200 0
## 2 " COASTAL FLOOD" 0 0 0 0
## 3 " FLASH FLOOD" 0 0 50 0
## 4 " LIGHTNING" 0 0 0 0
## 5 " TSTM WIND" 0 0 108 0
## 6 " TSTM WIND (G45)" 0 0 8 0
str(gevent)
## tibble [985 x 5] (S3: tbl_df/tbl/data.frame)
## $ EVTYPE : Factor w/ 985 levels " HIGH SURF ADVISORY",..: 1 2 3 4 5 6 7 8 9 10 ...
## $ sumfate: num [1:985] 0 0 0 0 0 0 0 0 0 0 ...
## $ suminj : num [1:985] 0 0 0 0 0 0 0 0 0 0 ...
## $ sumprop: num [1:985] 200 0 50 0 108 8 0 0 5 0 ...
## $ sumcrop: num [1:985] 0 0 0 0 0 0 0 0 0 0 ...
####Results * Check which events have the highest impact on health and fincance:
which.max(gevent$sumfate)
## [1] 834
which.max(gevent$suminj)
## [1] 834
which.max(gevent$sumprop)
## [1] 834
which.max(gevent$sumcrop)
## [1] 244
gevent[834,]
## # A tibble: 1 x 5
## EVTYPE sumfate suminj sumprop sumcrop
## <fct> <dbl> <dbl> <dbl> <dbl>
## 1 TORNADO 5633 91346 3212258. 100019.
gevent[244,]
## # A tibble: 1 x 5
## EVTYPE sumfate suminj sumprop sumcrop
## <fct> <dbl> <dbl> <dbl> <dbl>
## 1 HAIL 15 1361 688693. 579596.
Looks like tornados are the worst for fatalities, injuries, property damage, and hail is the worst for crop damage. * Make multi-panel bar chart to see how these impacts are distributed amongst event types
par(mfrow = c(2, 2), mar = c(8, 4, 2, 0))
barplot(height = gevent$sumfate, names = gevent$EVTYPE,
cex.names = 0.4, cex.axis = 0.4, cex.lab = 0.75,
xlab = "",
las = 2,
ylab = "Fatalities")
barplot(height = gevent$suminj, names = gevent$EVTYPE,
cex.names = 0.4, cex.axis = 0.4, cex.lab = 0.75,
xlab = "",
las = 2,
ylab = "Injuries")
barplot(height = gevent$sumprop, names = gevent$EVTYPE,
cex.names = 0.4, cex.axis = 0.4, cex.lab = 0.75,
xlab = "",
las = 2,
ylab = "Property Damage")
barplot(height = gevent$sumcrop, names = gevent$EVTYPE,
cex.names = 0.4, cex.axis = 0.4, cex.lab = 0.75,
xlab = "",
las = 2,
ylab = "Crop Damage")
mtext(side = 1, text = "Event Type", line = 7, at = -300, cex = 0.75)
mtext(side = 3, text = "Amount of Damage per Event", line = 14, at = -300, cex = 0.75)
* Find the proportion of impact each event type has. * Find the top 10 events for each health and financial impact
gevent$propfate <- gevent$sumfate/sum(gevent$sumfate)
gevent$propinj <- gevent$suminj/sum(gevent$suminj)
gevent$propprop <- gevent$sumprop/sum(gevent$sumprop)
gevent$propcrop <- gevent$sumcrop/sum(gevent$sumcrop)
topfatev <- head(gevent[order(gevent$propfate, decreasing = TRUE),],10)
topinjv <- head(gevent[order(gevent$propinj, decreasing = TRUE),],10)
toppropv <- head(gevent[order(gevent$propprop, decreasing = TRUE),],10)
topcropv<- head(gevent[order(gevent$propcrop, decreasing = TRUE),],10)
topfatev
## # A tibble: 10 x 9
## EVTYPE sumfate suminj sumprop sumcrop propfate propinj propprop propcrop
## <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 TORNADO 5633 91346 3.21e6 100019. 0.372 0.650 2.95e-1 0.0726
## 2 EXCESSIVE~ 1903 6525 1.46e3 494. 0.126 0.0464 1.34e-4 0.000359
## 3 FLASH FLO~ 978 1777 1.42e6 179200. 0.0646 0.0126 1.30e-1 0.130
## 4 HEAT 937 2100 2.98e2 663. 0.0619 0.0149 2.74e-5 0.000481
## 5 LIGHTNING 816 5230 6.03e5 3581. 0.0539 0.0372 5.54e-2 0.00260
## 6 TSTM WIND 504 6957 1.34e6 109203. 0.0333 0.0495 1.23e-1 0.0793
## 7 FLOOD 470 6789 9.00e5 168038. 0.0310 0.0483 8.27e-2 0.122
## 8 RIP CURRE~ 368 232 1 e0 0 0.0243 0.00165 9.19e-8 0
## 9 HIGH WIND 248 1137 3.25e5 17283. 0.0164 0.00809 2.98e-2 0.0125
## 10 AVALANCHE 224 170 1.62e3 0 0.0148 0.00121 1.49e-4 0
topinjv
## # A tibble: 10 x 9
## EVTYPE sumfate suminj sumprop sumcrop propfate propinj propprop propcrop
## <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 TORNADO 5633 91346 3.21e6 100019. 0.372 0.650 2.95e-1 0.0726
## 2 TSTM WIND 504 6957 1.34e6 109203. 0.0333 0.0495 1.23e-1 0.0793
## 3 FLOOD 470 6789 9.00e5 168038. 0.0310 0.0483 8.27e-2 0.122
## 4 EXCESSIVE ~ 1903 6525 1.46e3 494. 0.126 0.0464 1.34e-4 0.000359
## 5 LIGHTNING 816 5230 6.03e5 3581. 0.0539 0.0372 5.54e-2 0.00260
## 6 HEAT 937 2100 2.98e2 663. 0.0619 0.0149 2.74e-5 0.000481
## 7 ICE STORM 89 1975 6.60e4 1689. 0.00588 0.0141 6.06e-3 0.00123
## 8 FLASH FLOOD 978 1777 1.42e6 179200. 0.0646 0.0126 1.30e-1 0.130
## 9 THUNDERSTO~ 133 1488 8.77e5 66791. 0.00878 0.0106 8.06e-2 0.0485
## 10 HAIL 15 1361 6.89e5 579596. 0.000990 0.00968 6.33e-2 0.421
toppropv
## # A tibble: 10 x 9
## EVTYPE sumfate suminj sumprop sumcrop propfate propinj propprop propcrop
## <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 TORNADO 5633 91346 3.21e6 100019. 0.372 0.650 0.295 0.0726
## 2 FLASH FLOOD 978 1777 1.42e6 179200. 0.0646 0.0126 0.130 0.130
## 3 TSTM WIND 504 6957 1.34e6 109203. 0.0333 0.0495 0.123 0.0793
## 4 FLOOD 470 6789 9.00e5 168038. 0.0310 0.0483 0.0827 0.122
## 5 THUNDERSTO~ 133 1488 8.77e5 66791. 0.00878 0.0106 0.0806 0.0485
## 6 HAIL 15 1361 6.89e5 579596. 0.000990 0.00968 0.0633 0.421
## 7 LIGHTNING 816 5230 6.03e5 3581. 0.0539 0.0372 0.0554 0.00260
## 8 THUNDERSTO~ 64 908 4.46e5 18685. 0.00423 0.00646 0.0410 0.0136
## 9 HIGH WIND 248 1137 3.25e5 17283. 0.0164 0.00809 0.0298 0.0125
## 10 WINTER STO~ 206 1321 1.33e5 1979. 0.0136 0.00940 0.0122 0.00144
topcropv
## # A tibble: 10 x 9
## EVTYPE sumfate suminj sumprop sumcrop propfate propinj propprop propcrop
## <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 HAIL 15 1361 688693. 579596. 0.000990 9.68e-3 0.0633 0.421
## 2 FLASH FLO~ 978 1777 1420125. 179200. 0.0646 1.26e-2 0.130 0.130
## 3 FLOOD 470 6789 899938. 168038. 0.0310 4.83e-2 0.0827 0.122
## 4 TSTM WIND 504 6957 1335966. 109203. 0.0333 4.95e-2 0.123 0.0793
## 5 TORNADO 5633 91346 3212258. 100019. 0.372 6.50e-1 0.295 0.0726
## 6 THUNDERST~ 133 1488 876844. 66791. 0.00878 1.06e-2 0.0806 0.0485
## 7 DROUGHT 0 4 4099. 33899. 0 2.85e-5 0.000377 0.0246
## 8 THUNDERST~ 64 908 446293. 18685. 0.00423 6.46e-3 0.0410 0.0136
## 9 HIGH WIND 248 1137 324732. 17283. 0.0164 8.09e-3 0.0298 0.0125
## 10 HEAVY RAIN 98 251 50842. 11123. 0.00647 1.79e-3 0.00467 0.00807
gyears$propfate <- gyears$sumfate/sum(gyears$sumfate)
gyears$propinj <- gyears$suminj/sum(gyears$suminj)
gyears$propprop <- gyears$sumprop/sum(gyears$sumprop)
gyears$propcrop <- gyears$sumcrop/sum(gyears$sumcrop)
topfatey <- head(gyears[order(gyears$propfate, decreasing = TRUE),],10)
topinjy <- head(gyears[order(gyears$propinj, decreasing = TRUE),],10)
toppropy <- head(gyears[order(gyears$propprop, decreasing = TRUE),],10)
topcropy <- head(gyears[order(gyears$propcrop, decreasing = TRUE),],10)
topfatey
## # A tibble: 10 x 9
## YEARS sumfate suminj sumprop sumcrop propfate propinj propprop propcrop
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1995 1491 4480 319226. 35493 0.0984 0.0319 0.0293 0.0258
## 2 2011 1002 7792 820291. 98311 0.0662 0.0554 0.0754 0.0714
## 3 1999 908 5148 364612. 62707. 0.0600 0.0366 0.0335 0.0455
## 4 1998 687 11177 545845. 102235. 0.0454 0.0795 0.0501 0.0742
## 5 1997 601 3800 338000. 74075. 0.0397 0.0270 0.0311 0.0538
## 6 2006 599 3368 449584. 65851. 0.0396 0.0240 0.0413 0.0478
## 7 1996 542 2717 424503. 69292. 0.0358 0.0193 0.0390 0.0503
## 8 1953 519 5131 19182. 0 0.0343 0.0365 0.00176 0
## 9 2002 498 3155 355741. 49231. 0.0329 0.0225 0.0327 0.0357
## 10 2008 488 2703 690246. 183821 0.0322 0.0192 0.0634 0.133
topinjy
## # A tibble: 10 x 9
## YEARS sumfate suminj sumprop sumcrop propfate propinj propprop propcrop
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1998 687 11177 545845. 102235. 0.0454 0.0795 0.0501 0.0742
## 2 2011 1002 7792 820291. 98311 0.0662 0.0554 0.0754 0.0714
## 3 1974 366 6824 57905. 0 0.0242 0.0486 0.00532 0
## 4 1965 301 5197 46717. 0 0.0199 0.0370 0.00429 0
## 5 1999 908 5148 364612. 62707. 0.0600 0.0366 0.0335 0.0455
## 6 1953 519 5131 19182. 0 0.0343 0.0365 0.00176 0
## 7 1995 1491 4480 319226. 35493 0.0984 0.0319 0.0293 0.0258
## 8 1994 344 4161 622213. 88820. 0.0227 0.0296 0.0572 0.0645
## 9 1997 601 3800 338000. 74075. 0.0397 0.0270 0.0311 0.0538
## 10 2006 599 3368 449584. 65851. 0.0396 0.0240 0.0413 0.0478
toppropy
## # A tibble: 10 x 9
## YEARS sumfate suminj sumprop sumcrop propfate propinj propprop propcrop
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2011 1002 7792 820291. 98311 0.0662 0.0554 0.0754 0.0714
## 2 2008 488 2703 690246. 183821 0.0322 0.0192 0.0634 0.133
## 3 1994 344 4161 622213. 88820. 0.0227 0.0296 0.0572 0.0645
## 4 2010 425 1855 594848. 59014 0.0281 0.0132 0.0547 0.0428
## 5 2009 333 1354 553433. 59683 0.0220 0.00964 0.0508 0.0433
## 6 1998 687 11177 545845. 102235. 0.0454 0.0795 0.0501 0.0742
## 7 1993 298 2149 477319. 51661. 0.0197 0.0153 0.0439 0.0375
## 8 2006 599 3368 449584. 65851. 0.0396 0.0240 0.0413 0.0478
## 9 2007 421 2191 438170. 76768 0.0278 0.0156 0.0403 0.0557
## 10 2003 443 2931 437755. 52322. 0.0293 0.0209 0.0402 0.0380
topcropy
## # A tibble: 10 x 9
## YEARS sumfate suminj sumprop sumcrop propfate propinj propprop propcrop
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2008 488 2703 690246. 183821 0.0322 0.0192 0.0634 0.133
## 2 1998 687 11177 545845. 102235. 0.0454 0.0795 0.0501 0.0742
## 3 2011 1002 7792 820291. 98311 0.0662 0.0554 0.0754 0.0714
## 4 1994 344 4161 622213. 88820. 0.0227 0.0296 0.0572 0.0645
## 5 2000 477 2803 403471. 79414. 0.0315 0.0199 0.0371 0.0576
## 6 2007 421 2191 438170. 76768 0.0278 0.0156 0.0403 0.0557
## 7 1997 601 3800 338000. 74075. 0.0397 0.0270 0.0311 0.0538
## 8 2004 370 2426 412838. 72439. 0.0244 0.0173 0.0379 0.0526
## 9 1996 542 2717 424503. 69292. 0.0358 0.0193 0.0390 0.0503
## 10 2006 599 3368 449584. 65851. 0.0396 0.0240 0.0413 0.0478
A table of the top 10 offending events for each human impact category:
propfate <- topfatev[,-2:-5]
propfate <- propfate[,-3:-5]
propfate$propfate <- round(propfate$propfate, 2)
propinj <- topinjv[,-2:-6]
propinj <- propinj[,-3:-4]
propinj$propinj <- round(propinj$propinj, 2)
propprop <- toppropv[,-2:-7]
propprop <- propprop[,-3]
propprop$propprop <- round(propprop$propprop,2)
propcrop <- topcropv[,-2:-8]
propcrop$propcrop <- round(propcrop$propcrop, 2)
top10 <- cbind(propfate, propinj, propprop, propcrop)
top10
## EVTYPE propfate EVTYPE propinj EVTYPE
## 1 TORNADO 0.37 TORNADO 0.65 TORNADO
## 2 EXCESSIVE HEAT 0.13 TSTM WIND 0.05 FLASH FLOOD
## 3 FLASH FLOOD 0.06 FLOOD 0.05 TSTM WIND
## 4 HEAT 0.06 EXCESSIVE HEAT 0.05 FLOOD
## 5 LIGHTNING 0.05 LIGHTNING 0.04 THUNDERSTORM WIND
## 6 TSTM WIND 0.03 HEAT 0.01 HAIL
## 7 FLOOD 0.03 ICE STORM 0.01 LIGHTNING
## 8 RIP CURRENT 0.02 FLASH FLOOD 0.01 THUNDERSTORM WINDS
## 9 HIGH WIND 0.02 THUNDERSTORM WIND 0.01 HIGH WIND
## 10 AVALANCHE 0.01 HAIL 0.01 WINTER STORM
## propprop EVTYPE propcrop
## 1 0.30 HAIL 0.42
## 2 0.13 FLASH FLOOD 0.13
## 3 0.12 FLOOD 0.12
## 4 0.08 TSTM WIND 0.08
## 5 0.08 TORNADO 0.07
## 6 0.06 THUNDERSTORM WIND 0.05
## 7 0.06 DROUGHT 0.02
## 8 0.04 THUNDERSTORM WINDS 0.01
## 9 0.03 HIGH WIND 0.01
## 10 0.01 HEAVY RAIN 0.01
par(mfrow = c(2, 2), mar = c(2, 2, 2, 0))
barplot(height = gyears$sumfate, names = gyears$YEARS,
cex.names = 0.5, cex.axis = 0.8, cex.lab = 0.75,
xlab = "",
las = 2,
ylab = "Fatalities")
barplot(height = gyears$suminj, names = gyears$YEARS,
cex.names = 0.5, cex.axis = 0.8, cex.lab = 0.75,
xlab = "",
las = 2,
ylab = "Injuries")
barplot(height = gyears$sumprop, names = gyears$YEARS,
cex.names = 0.5, cex.axis = 0.8, cex.lab = 0.75,
xlab = "",
las = 2,
ylab = "Property Damage")
barplot(height = gyears$sumcrop, names = gyears$YEARS,
cex.names = 0.5, cex.axis = 0.8, cex.lab = 0.75,
xlab = "",
las = 2,
ylab = "Crop Damage")
mtext(side = 1, text = "Year", line = 0, at = -300, cex = 0.75)
mtext(side = 3, text = "Yearly Damage in each Category", line = 2, at = -400, cex = 0.2)