This analysis references the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database to find events that have had the most economic impact (based on property and crop damage) and health impact (based on fatalities and injuries) in the US. The NOAA 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.
We will use the following libraries to explora and analyze the data:
library(tidyr)
library(dplyr)
library(ggplot2)
library(lubridate)
library(gridExtra)
Data is downloaded from the course website.
dirName <- "data"
fileName <- "repdata_data_StormData.csv.bz2"
URL <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"
dirPath <- paste0("./",dirName)
newFilePath <- paste0(dirPath,"/",fileName)
if(!file.exists(dirName)){
dir.create(dirName)
}
##Commenting because to avoid downloading every time the program is run
##download.file(URL,newFilePath )
noaaData <- read.csv(newFilePath)
The dataset has 902,297 observations and 37 variables.
str(noaaData)
## 'data.frame': 902297 obs. of 37 variables:
## $ STATE__ : num 1 1 1 1 1 1 1 1 1 1 ...
## $ BGN_DATE : Factor w/ 16335 levels "1/1/1966 0:00:00",..: 6523 6523 4242 11116 2224 2224 2260 383 3980 3980 ...
## $ BGN_TIME : Factor w/ 3608 levels "00:00:00 AM",..: 272 287 2705 1683 2584 3186 242 1683 3186 3186 ...
## $ TIME_ZONE : Factor w/ 22 levels "ADT","AKS","AST",..: 7 7 7 7 7 7 7 7 7 7 ...
## $ COUNTY : num 97 3 57 89 43 77 9 123 125 57 ...
## $ COUNTYNAME: Factor w/ 29601 levels "","5NM E OF MACKINAC BRIDGE TO PRESQUE ISLE LT MI",..: 13513 1873 4598 10592 4372 10094 1973 23873 24418 4598 ...
## $ STATE : Factor w/ 72 levels "AK","AL","AM",..: 2 2 2 2 2 2 2 2 2 2 ...
## $ EVTYPE : Factor w/ 985 levels " HIGH SURF ADVISORY",..: 834 834 834 834 834 834 834 834 834 834 ...
## $ BGN_RANGE : num 0 0 0 0 0 0 0 0 0 0 ...
## $ BGN_AZI : Factor w/ 35 levels ""," N"," NW",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ BGN_LOCATI: Factor w/ 54429 levels "","- 1 N Albion",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ END_DATE : Factor w/ 6663 levels "","1/1/1993 0:00:00",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ END_TIME : Factor w/ 3647 levels ""," 0900CST",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ 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 : Factor w/ 24 levels "","E","ENE","ESE",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ END_LOCATI: Factor w/ 34506 levels "","- .5 NNW",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ 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: Factor w/ 19 levels "","-","?","+",..: 17 17 17 17 17 17 17 17 17 17 ...
## $ CROPDMG : num 0 0 0 0 0 0 0 0 0 0 ...
## $ CROPDMGEXP: Factor w/ 9 levels "","?","0","2",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ WFO : Factor w/ 542 levels ""," CI","$AC",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ STATEOFFIC: Factor w/ 250 levels "","ALABAMA, Central",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ ZONENAMES : Factor w/ 25112 levels ""," "| __truncated__,..: 1 1 1 1 1 1 1 1 1 1 ...
## $ 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 : Factor w/ 436781 levels "","-2 at Deer Park\n",..: 1 1 1 1 1 1 1 1 1 1 ...
## $ REFNUM : num 1 2 3 4 5 6 7 8 9 10 ...
summary(noaaData)
## STATE__ BGN_DATE BGN_TIME
## Min. : 1.0 5/25/2011 0:00:00: 1202 12:00:00 AM: 10163
## 1st Qu.:19.0 4/27/2011 0:00:00: 1193 06:00:00 PM: 7350
## Median :30.0 6/9/2011 0:00:00 : 1030 04:00:00 PM: 7261
## Mean :31.2 5/30/2004 0:00:00: 1016 05:00:00 PM: 6891
## 3rd Qu.:45.0 4/4/2011 0:00:00 : 1009 12:00:00 PM: 6703
## Max. :95.0 4/2/2006 0:00:00 : 981 03:00:00 PM: 6700
## (Other) :895866 (Other) :857229
## TIME_ZONE COUNTY COUNTYNAME STATE
## CST :547493 Min. : 0.0 JEFFERSON : 7840 TX : 83728
## EST :245558 1st Qu.: 31.0 WASHINGTON: 7603 KS : 53440
## MST : 68390 Median : 75.0 JACKSON : 6660 OK : 46802
## PST : 28302 Mean :100.6 FRANKLIN : 6256 MO : 35648
## AST : 6360 3rd Qu.:131.0 LINCOLN : 5937 IA : 31069
## HST : 2563 Max. :873.0 MADISON : 5632 NE : 30271
## (Other): 3631 (Other) :862369 (Other):621339
## EVTYPE BGN_RANGE BGN_AZI
## HAIL :288661 Min. : 0.000 :547332
## TSTM WIND :219940 1st Qu.: 0.000 N : 86752
## THUNDERSTORM WIND: 82563 Median : 0.000 W : 38446
## TORNADO : 60652 Mean : 1.484 S : 37558
## FLASH FLOOD : 54277 3rd Qu.: 1.000 E : 33178
## FLOOD : 25326 Max. :3749.000 NW : 24041
## (Other) :170878 (Other):134990
## BGN_LOCATI END_DATE END_TIME
## :287743 :243411 :238978
## COUNTYWIDE : 19680 4/27/2011 0:00:00: 1214 06:00:00 PM: 9802
## Countywide : 993 5/25/2011 0:00:00: 1196 05:00:00 PM: 8314
## SPRINGFIELD : 843 6/9/2011 0:00:00 : 1021 04:00:00 PM: 8104
## SOUTH PORTION: 810 4/4/2011 0:00:00 : 1007 12:00:00 PM: 7483
## NORTH PORTION: 784 5/30/2004 0:00:00: 998 11:59:00 PM: 7184
## (Other) :591444 (Other) :653450 (Other) :622432
## COUNTY_END COUNTYENDN END_RANGE END_AZI
## Min. :0 Mode:logical Min. : 0.0000 :724837
## 1st Qu.:0 NA's:902297 1st Qu.: 0.0000 N : 28082
## Median :0 Median : 0.0000 S : 22510
## Mean :0 Mean : 0.9862 W : 20119
## 3rd Qu.:0 3rd Qu.: 0.0000 E : 20047
## Max. :0 Max. :925.0000 NE : 14606
## (Other): 72096
## END_LOCATI LENGTH WIDTH
## :499225 Min. : 0.0000 Min. : 0.000
## COUNTYWIDE : 19731 1st Qu.: 0.0000 1st Qu.: 0.000
## SOUTH PORTION : 833 Median : 0.0000 Median : 0.000
## NORTH PORTION : 780 Mean : 0.2301 Mean : 7.503
## CENTRAL PORTION: 617 3rd Qu.: 0.0000 3rd Qu.: 0.000
## SPRINGFIELD : 575 Max. :2315.0000 Max. :4400.000
## (Other) :380536
## F MAG FATALITIES INJURIES
## Min. :0.0 Min. : 0.0 Min. : 0.0000 Min. : 0.0000
## 1st Qu.:0.0 1st Qu.: 0.0 1st Qu.: 0.0000 1st Qu.: 0.0000
## Median :1.0 Median : 50.0 Median : 0.0000 Median : 0.0000
## Mean :0.9 Mean : 46.9 Mean : 0.0168 Mean : 0.1557
## 3rd Qu.:1.0 3rd Qu.: 75.0 3rd Qu.: 0.0000 3rd Qu.: 0.0000
## Max. :5.0 Max. :22000.0 Max. :583.0000 Max. :1700.0000
## NA's :843563
## PROPDMG PROPDMGEXP CROPDMG CROPDMGEXP
## Min. : 0.00 :465934 Min. : 0.000 :618413
## 1st Qu.: 0.00 K :424665 1st Qu.: 0.000 K :281832
## Median : 0.00 M : 11330 Median : 0.000 M : 1994
## Mean : 12.06 0 : 216 Mean : 1.527 k : 21
## 3rd Qu.: 0.50 B : 40 3rd Qu.: 0.000 0 : 19
## Max. :5000.00 5 : 28 Max. :990.000 B : 9
## (Other): 84 (Other): 9
## WFO STATEOFFIC
## :142069 :248769
## OUN : 17393 TEXAS, North : 12193
## JAN : 13889 ARKANSAS, Central and North Central: 11738
## LWX : 13174 IOWA, Central : 11345
## PHI : 12551 KANSAS, Southwest : 11212
## TSA : 12483 GEORGIA, North and Central : 11120
## (Other):690738 (Other) :595920
## ZONENAMES
## :594029
## :205988
## GREATER RENO / CARSON CITY / M - GREATER RENO / CARSON CITY / M : 639
## GREATER LAKE TAHOE AREA - GREATER LAKE TAHOE AREA : 592
## JEFFERSON - JEFFERSON : 303
## MADISON - MADISON : 302
## (Other) :100444
## LATITUDE LONGITUDE LATITUDE_E LONGITUDE_
## Min. : 0 Min. :-14451 Min. : 0 Min. :-14455
## 1st Qu.:2802 1st Qu.: 7247 1st Qu.: 0 1st Qu.: 0
## Median :3540 Median : 8707 Median : 0 Median : 0
## Mean :2875 Mean : 6940 Mean :1452 Mean : 3509
## 3rd Qu.:4019 3rd Qu.: 9605 3rd Qu.:3549 3rd Qu.: 8735
## Max. :9706 Max. : 17124 Max. :9706 Max. :106220
## NA's :47 NA's :40
## REMARKS REFNUM
## :287433 Min. : 1
## : 24013 1st Qu.:225575
## Trees down.\n : 1110 Median :451149
## Several trees were blown down.\n : 568 Mean :451149
## Trees were downed.\n : 446 3rd Qu.:676723
## Large trees and power lines were blown down.\n: 432 Max. :902297
## (Other) :588295
The following transformations were needed in order to complete the required data analysis:
processedNoaaData <- noaaData
processedNoaaData$EVTYPE <- toupper(processedNoaaData$EVTYPE)
##Group Similar events together. The data is not standardized
processedNoaaData$EVTYPE[grep("AVALAN", processedNoaaData$EVTYPE)] <-
"AVALANCHE"
processedNoaaData$EVTYPE[grep("BLIZ", processedNoaaData$EVTYPE)] <-
"BLIZZARD"
processedNoaaData$EVTYPE[grep("FLOOD|FLDG|FLD|FLOOO", processedNoaaData$EVTYPE)] <-
"FLOOD"
processedNoaaData$EVTYPE[grep("RAIN", processedNoaaData$EVTYPE)] <-
"HEAVY RAIN"
processedNoaaData$EVTYPE[grep("WARMTH|HEAT|HEATWAVE|HOT|HIGH TEMP" ,
processedNoaaData$EVTYPE)] <-
"HEAT"
processedNoaaData$EVTYPE[grep("FLOOD", processedNoaaData$EVTYPE)] <-
"FLOOD"
processedNoaaData$EVTYPE[grep("FOG", processedNoaaData$EVTYPE)] <-
"FOG"
processedNoaaData$EVTYPE[grep("FROST", processedNoaaData$EVTYPE)] <-
"FROST"
processedNoaaData$EVTYPE[grep("HURRICANE", processedNoaaData$EVTYPE)] <-
"HURRICANE"
processedNoaaData$EVTYPE[grep("SNOW", processedNoaaData$EVTYPE)] <-
"SNOW"
processedNoaaData$EVTYPE[grep("THUNDER|TSTM", processedNoaaData$EVTYPE)] <-
"TSTM"
processedNoaaData$EVTYPE[grep("STORM SURGE", processedNoaaData$EVTYPE)] <-
"STORM SURGE"
processedNoaaData$EVTYPE[grep("LIGHTN|LIGHTI|LIGNT", processedNoaaData$EVTYPE)] <-
"LIGHTNING"
processedNoaaData$EVTYPE[grep("WIND|WND", processedNoaaData$EVTYPE)] <-
"WIND"
processedNoaaData$EVTYPE[grep("TORN", processedNoaaData$EVTYPE)] <-
"TORNADO"
processedNoaaData$EVTYPE[grep("WILD", processedNoaaData$EVTYPE)] <-
"WILDFIRE"
processedNoaaData$EVTYPE[grep("RIP", processedNoaaData$EVTYPE)] <-
"RIP CURRENT"
##Get actual multiple for property and crop damages. Had to do some research.
##Property Damages
processedNoaaData <- processedNoaaData %>% mutate(PropertyDamageExp = 0)
processedNoaaData[processedNoaaData$PROPDMGEXP %in% c("H","h"),]$PropertyDamageExp <- 10^2
processedNoaaData[processedNoaaData$PROPDMGEXP %in% c("K","k"),]$PropertyDamageExp <- 10^3
processedNoaaData[processedNoaaData$PROPDMGEXP %in% c("M","m"),]$PropertyDamageExp <- 10^6
processedNoaaData[processedNoaaData$PROPDMGEXP %in% c("B","b"),]$PropertyDamageExp <- 10^9
processedNoaaData[processedNoaaData$PROPDMGEXP == "+",]$PropertyDamageExp <- 1
processedNoaaData[processedNoaaData$PROPDMGEXP %in% c("0","1","2","3","4","5","6","7","8"),]$PropertyDamageExp <- 10
processedNoaaData[processedNoaaData$PROPDMGEXP %in% c("-","?",""),]$PropertyDamageExp <- 0
processedNoaaData <- processedNoaaData %>% mutate(ActualPropertyDamage = PropertyDamageExp * PROPDMG,
ActualPropertyDamageInMillions = ActualPropertyDamage/(10^6) )
##Crop Damages
processedNoaaData <- processedNoaaData %>% mutate(CropDamageExp = 0)
##processedNoaaData[processedNoaaData$CROPDMGEXP %in% c("H","h"),]$CropDamageExp <- 10^2
processedNoaaData[processedNoaaData$CROPDMGEXP %in% c("K","k"),]$CropDamageExp <- 10^3
processedNoaaData[processedNoaaData$CROPDMGEXP %in% c("M","m"),]$CropDamageExp <- 10^6
processedNoaaData[processedNoaaData$CROPDMGEXP %in% c("B","b"),]$CropDamageExp <- 10^9
#processedNoaaData[processedNoaaData$CROPDMGEXP == "+",]$CropDamageExp <- 1
processedNoaaData[processedNoaaData$CROPDMGEXP %in% c("0","1","2","3","4","5","6","7","8"),]$CropDamageExp <- 10
processedNoaaData[processedNoaaData$CROPDMGEXP %in% c("-","?",""),]$CropDamageExp <- 0
processedNoaaData <- processedNoaaData %>% mutate(ActualCropDamage = CropDamageExp * CROPDMG,
ActualCropDamageInMillions = ActualCropDamage/(10^6) )
Filter for data after 1980- Since data for most event types is not available for earlier years, the analysis is focused in the last 40 years.
Select and rename relevant data points- Only event type, begin date, fatalities, injuries, property damage and crop damage are needed for the purpose of this analysis.
processedNoaaData <- processedNoaaData %>%
select(BGN_DATE,
STATE, EVTYPE,
FATALITIES,
INJURIES,
ActualPropertyDamageInMillions,
ActualCropDamageInMillions ) %>%
rename(BeginDate = BGN_DATE,
EventType = EVTYPE,
TotalFatalities = FATALITIES,
TotalInjuries = INJURIES) %>%
mutate(TotalEconomicDamage = ActualPropertyDamageInMillions + ActualPropertyDamageInMillions) %>%
mutate(TotalHealthImpact = TotalFatalities + TotalInjuries) %>%
mutate(date = as.Date(BeginDate, format = "%m/%d/%Y")) %>%
mutate(year= year(date)) %>%
filter(year > 1980)
eventTypeSummary <- processedNoaaData %>%
group_by(EventType) %>%
summarise(totalFatalities = sum(TotalFatalities),
totalInjuries = sum(TotalInjuries),
totalHealthImpact = sum(TotalHealthImpact),
totalPropertyDamage = sum(ActualPropertyDamageInMillions),
totalCropDamage = sum(ActualCropDamageInMillions),
totalEconomicDamage = sum(TotalEconomicDamage),
totalEvents = n(),
fatalityRate = totalFatalities/totalEvents,
injuryRate = totalInjuries/totalEvents,
healthDamageRate = totalHealthImpact/totalEvents,
economicDamageRate = totalEconomicDamage/totalEvents,
cropDamageRate = totalCropDamage/totalEvents) %>%
filter(totalEvents > 50)
##Economic Impact Breakdown
propertyDamage <- eventTypeSummary %>%
mutate(DamageType = "Property", Total = totalPropertyDamage) %>%
select(EventType, DamageType, Total, totalEconomicDamage, economicDamageRate, totalEvents)
cropDamage <- eventTypeSummary %>%
mutate(DamageType = "Crop", Total = totalCropDamage) %>%
select(EventType, DamageType, Total, totalEconomicDamage, economicDamageRate, totalEvents)
##Health Impact Breakdown
fatalities <- eventTypeSummary %>%
mutate(HealthImpact = "Fatalities", Total = totalFatalities) %>%
select(EventType, HealthImpact, Total, totalHealthImpact, healthDamageRate, totalEvents)
injuries <- eventTypeSummary %>%
mutate(HealthImpact = "Injuries", Total = totalInjuries) %>%
select(EventType, HealthImpact, Total, totalHealthImpact, healthDamageRate, totalEvents)
The analysis covers idividual and cumulative health and economic impact for event types. We also want to check the trend to see if the impact is decreasing over time as the US takes preventive and protective measures over these events.
Tornados have had the greatest cumulative ecnomic impact since 1980, but hurricanes have the most economic damage per individual event.
##Calculate and plot Cumulative Health Impact
cumulativeHealthImpact <- rbind(fatalities,injuries) %>% arrange(desc(totalHealthImpact)) %>% slice(1:10)
plotCumulativeHealthImpact <-
ggplot(cumulativeHealthImpact, aes(x=reorder(EventType, -Total) , y= Total, fill=HealthImpact)) +
geom_bar(stat = "identity") +
labs(title = "Event Types with Most \nCumulative Health Damaage", x="Event Type", y="Total Injuries & Fatalities") +
theme(axis.text.x = element_text(angle = 90, hjust = 1),legend.position = "bottom")
##Calculate and plot impact of each event
individualHealthImpact <- eventTypeSummary %>%
arrange(desc(healthDamageRate)) %>%
select(EventType,healthDamageRate, totalHealthImpact, totalEvents) %>% slice(1:5)
plotHealthDamagePerEvent <-
ggplot(individualHealthImpact, aes(x= reorder(EventType, -healthDamageRate), y= healthDamageRate)) +
geom_bar(stat = "identity", fill="darkcyan") +
labs(title = "Individual Events Causing Most \nHealth Damage", x= "Event Type", y = "Health Damage Rate") +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
##Arrange plots side by side on a grid
grid.arrange(plotCumulativeHealthImpact, plotHealthDamagePerEvent, nrow = 1, ncol = 2)
Figure 2: Health Impact
Viewing the detailed data below:
##print details
cumulativeHealthImpact
## # A tibble: 10 x 6
## EventType HealthImpact Total totalHealthImpact healthDamageRate totalEvents
## <chr> <chr> <dbl> <dbl> <dbl> <int>
## 1 TORNADO Fatalities 2249 39124 1.03 37849
## 2 TORNADO Injuries 36875 39124 1.03 37849
## 3 HEAT Fatalities 3138 12362 4.34 2847
## 4 HEAT Injuries 9224 12362 4.34 2847
## 5 TSTM Fatalities 755 10299 0.0342 301280
## 6 TSTM Injuries 9544 10299 0.0342 301280
## 7 FLOOD Fatalities 1553 10236 0.119 86128
## 8 FLOOD Injuries 8683 10236 0.119 86128
## 9 LIGHTNING Fatalities 817 6048 0.384 15765
## 10 LIGHTNING Injuries 5231 6048 0.384 15765
individualHealthImpact
## # A tibble: 5 x 4
## EventType healthDamageRate totalHealthImpact totalEvents
## <chr> <dbl> <dbl> <int>
## 1 HURRICANE 5.08 1463 288
## 2 HEAT 4.34 12362 2847
## 3 ICE 2.34 143 61
## 4 RIP CURRENT 1.42 1106 777
## 5 DUST STORM 1.08 462 427
Floods have had the greatest cumulative ecnomic impact since 1980, but hurricanes have the most economic damage per individual event.
##Calculate and plot cumulative economic impact
cumulativeEconomicImpact <- rbind(propertyDamage,cropDamage) %>% arrange(desc(totalEconomicDamage)) %>% slice(1:10)
plotCumulativeEconomicImpact <-
ggplot(cumulativeEconomicImpact, aes(x = reorder(EventType, -Total), y = Total, fill=DamageType)) +
geom_bar(stat = "identity") +
labs(title = "Event Types with Most \nCumulative Economic Impact",
x = "Event Type", y = "Economic Damage (in millions)",
legend = "Damage Type") +
theme(axis.text.x = element_text(angle = 90, hjust = 1), legend.position = "bottom")
##Calculate and plot individual economic impact
individualEconomicImpact <- eventTypeSummary %>%
arrange(desc(economicDamageRate)) %>%
select(EventType,economicDamageRate, totalEconomicDamage, totalEvents) %>%
slice(1:5)
plotEconomicImpactPerEvent <-
ggplot(individualEconomicImpact, aes(x = reorder(EventType, -economicDamageRate), y = economicDamageRate)) +
geom_bar(stat = "identity", fill="darkcyan") +
labs(title = "Event Types with Most \nIndividual Economic Impact",
x = "Event Type", y = "Economic Damage (in millions)") +
theme(axis.text.x = element_text(angle = 90, hjust = 1))
##Arrange plots side by side on a grid
grid.arrange(plotCumulativeEconomicImpact, plotEconomicImpactPerEvent, nrow = 1, ncol = 2)
Figure 3: Economic Impact
Viewing the detailed data below:
##print details
cumulativeEconomicImpact
## # A tibble: 10 x 6
## EventType DamageType Total totalEconomicDam~ economicDamageR~ totalEvents
## <chr> <chr> <dbl> <dbl> <dbl> <int>
## 1 FLOOD Property 1.68e+5 335176. 3.89 86128
## 2 FLOOD Crop 1.24e+4 335176. 3.89 86128
## 3 HURRICANE Property 8.48e+4 169512. 589. 288
## 4 HURRICANE Crop 5.52e+3 169512. 589. 288
## 5 STORM SUR~ Property 4.80e+4 95929. 235. 409
## 6 STORM SUR~ Crop 8.55e-1 95929. 235. 409
## 7 TORNADO Property 4.15e+4 83083. 2.20 37849
## 8 TORNADO Crop 4.15e+2 83083. 2.20 37849
## 9 HAIL Property 1.57e+4 31465. 0.118 265525
## 10 HAIL Crop 3.03e+3 31465. 0.118 265525
individualEconomicImpact
## # A tibble: 5 x 4
## EventType economicDamageRate totalEconomicDamage totalEvents
## <chr> <dbl> <dbl> <int>
## 1 HURRICANE 589. 169512. 288
## 2 STORM SURGE 235. 95929. 409
## 3 TROPICAL STORM 22.3 15408. 690
## 4 WILDFIRE 4.01 16983. 4231
## 5 ICE STORM 3.93 7890. 2006
Hurricanes have had the a significant negative impact on health and the economy in the US. Hurricanes are getting stronger but the US has also taken more preventive measures over the years. Both the economic and health impact seem to be increasing over the years. Hurricanes are getting stronger and the security measures are probably not enough.
#Economic Impact By Year
hurricanImpactByYear <- processedNoaaData %>%
filter(EventType == "HURRICANE") %>%
group_by(EventType,year) %>%
summarise(
totalPropertyDamage = sum(ActualPropertyDamageInMillions),
totalCropDamage = sum(ActualCropDamageInMillions),
totalEconomicDamage = sum(TotalEconomicDamage),
totalEvents = n(),
economicDamageRate = totalEconomicDamage/totalEvents,
totalFatalities = sum(TotalFatalities),
totalInjuries = sum(TotalInjuries),
totalHealthImpact = sum(TotalHealthImpact),
fatalityRate = totalFatalities/totalEvents,
injuryRate = totalInjuries/totalEvents,
healthDamageRate = totalHealthImpact/totalEvents)
plotEconomicDamageTrend <- ggplot(hurricanImpactByYear, aes(year, economicDamageRate)) +
geom_point() +
geom_smooth(method=lm, se=FALSE) +
labs(title = "Hurricane Economic Damage Rate \nBy Year", x = "Economic Damage Rate (in millions)")
##Health Impact By Year
plotHealthDamageTrend <- ggplot(hurricanImpactByYear, aes(year, healthDamageRate)) +
geom_point() +
geom_smooth(method=lm, se=FALSE) +
labs(title = "Hurricane Health Damage Rate \nBy Year", x = "Health Damage Rate")
##Arrange plots side by side on a grid
grid.arrange(plotEconomicDamageTrend, plotHealthDamageTrend, nrow = 1)
Figure 3: Impact Trends