In this analysis we establish potential impacts that severe weather phenomena have on public health and which have the greatest health consequences.
The data that we are working with is from NOAA. It contains 37 fields:
df<-read.csv('repdata_data_StormData.csv')
summary(df)
## STATE__ BGN_DATE BGN_TIME TIME_ZONE
## Min. : 1.0 Length:902297 Length:902297 Length:902297
## 1st Qu.:19.0 Class :character Class :character Class :character
## Median :30.0 Mode :character Mode :character Mode :character
## Mean :31.2
## 3rd Qu.:45.0
## Max. :95.0
##
## COUNTY COUNTYNAME STATE EVTYPE
## Min. : 0.0 Length:902297 Length:902297 Length:902297
## 1st Qu.: 31.0 Class :character Class :character Class :character
## Median : 75.0 Mode :character Mode :character Mode :character
## Mean :100.6
## 3rd Qu.:131.0
## Max. :873.0
##
## BGN_RANGE BGN_AZI BGN_LOCATI END_DATE
## Min. : 0.000 Length:902297 Length:902297 Length:902297
## 1st Qu.: 0.000 Class :character Class :character Class :character
## Median : 0.000 Mode :character Mode :character Mode :character
## Mean : 1.484
## 3rd Qu.: 1.000
## Max. :3749.000
##
## END_TIME COUNTY_END COUNTYENDN END_RANGE
## Length:902297 Min. :0 Mode:logical Min. : 0.0000
## Class :character 1st Qu.:0 NA's:902297 1st Qu.: 0.0000
## Mode :character Median :0 Median : 0.0000
## Mean :0 Mean : 0.9862
## 3rd Qu.:0 3rd Qu.: 0.0000
## Max. :0 Max. :925.0000
##
## END_AZI END_LOCATI LENGTH WIDTH
## Length:902297 Length:902297 Min. : 0.0000 Min. : 0.000
## Class :character Class :character 1st Qu.: 0.0000 1st Qu.: 0.000
## Mode :character Mode :character Median : 0.0000 Median : 0.000
## Mean : 0.2301 Mean : 7.503
## 3rd Qu.: 0.0000 3rd Qu.: 0.000
## Max. :2315.0000 Max. :4400.000
##
## 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 Length:902297 Min. : 0.000 Length:902297
## 1st Qu.: 0.00 Class :character 1st Qu.: 0.000 Class :character
## Median : 0.00 Mode :character Median : 0.000 Mode :character
## Mean : 12.06 Mean : 1.527
## 3rd Qu.: 0.50 3rd Qu.: 0.000
## Max. :5000.00 Max. :990.000
##
## WFO STATEOFFIC ZONENAMES LATITUDE
## Length:902297 Length:902297 Length:902297 Min. : 0
## Class :character Class :character Class :character 1st Qu.:2802
## Mode :character Mode :character Mode :character Median :3540
## Mean :2875
## 3rd Qu.:4019
## Max. :9706
## NA's :47
## LONGITUDE LATITUDE_E LONGITUDE_ REMARKS
## Min. :-14451 Min. : 0 Min. :-14455 Length:902297
## 1st Qu.: 7247 1st Qu.: 0 1st Qu.: 0 Class :character
## Median : 8707 Median : 0 Median : 0 Mode :character
## Mean : 6940 Mean :1452 Mean : 3509
## 3rd Qu.: 9605 3rd Qu.:3549 3rd Qu.: 8735
## Max. : 17124 Max. :9706 Max. :106220
## NA's :40
## REFNUM
## Min. : 1
## 1st Qu.:225575
## Median :451149
## Mean :451149
## 3rd Qu.:676723
## Max. :902297
##
We will mostly be interested in EVTYPE, which contains the type of events,
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
event_counts <- df %>%
group_by(EVTYPE) %>%
summarise('Counts' = n()) %>%
arrange( desc(Counts))
head(event_counts, 50)
## # A tibble: 50 × 2
## EVTYPE Counts
## <chr> <int>
## 1 HAIL 288661
## 2 TSTM WIND 219940
## 3 THUNDERSTORM WIND 82563
## 4 TORNADO 60652
## 5 FLASH FLOOD 54277
## 6 FLOOD 25326
## 7 THUNDERSTORM WINDS 20843
## 8 HIGH WIND 20212
## 9 LIGHTNING 15754
## 10 HEAVY SNOW 15708
## # ℹ 40 more rows
We are interested in the impact of these on public health. The event fatalities and injuries are given in the columns FATALITIES and INJURIES:
event_health_summaries <- df %>%
group_by(EVTYPE) %>%
summarise('Counts' = n(),
'Ave. Event Fatalities'= mean(FATALITIES),
'Fatality Frequency' = 1/mean(FATALITIES),
'Ave. Event Injuries'= mean(INJURIES),
'Injury Frequency'= 1/mean(INJURIES)
) %>%
arrange( desc(Counts))
head(event_health_summaries, 50)
## # A tibble: 50 × 6
## EVTYPE Counts `Ave. Event Fatalities` `Fatality Frequency`
## <chr> <int> <dbl> <dbl>
## 1 HAIL 288661 0.0000520 19244.
## 2 TSTM WIND 219940 0.00229 436.
## 3 THUNDERSTORM WIND 82563 0.00161 621.
## 4 TORNADO 60652 0.0929 10.8
## 5 FLASH FLOOD 54277 0.0180 55.5
## 6 FLOOD 25326 0.0186 53.9
## 7 THUNDERSTORM WINDS 20843 0.00307 326.
## 8 HIGH WIND 20212 0.0123 81.5
## 9 LIGHTNING 15754 0.0518 19.3
## 10 HEAVY SNOW 15708 0.00809 124.
## # ℹ 40 more rows
## # ℹ 2 more variables: `Ave. Event Injuries` <dbl>, `Injury Frequency` <dbl>
The 10 most deadly forms of weather events can be classified as the 10 with the highest number of fatalities. We plot the counts for these here:
fatalities <- df %>%
group_by(EVTYPE) %>%
summarise(
'total fatality counts'= sum(FATALITIES),
) %>%
arrange( desc(`total fatality counts`))
z<-barplot(head(fatalities$`total fatality counts`, 10),
col='red',
main= 'Most Deadly Weather Events',
names= head(fatalities$EVTYPE,10),
las=2,
cex.names=.5)
z
## [,1]
## [1,] 0.7
## [2,] 1.9
## [3,] 3.1
## [4,] 4.3
## [5,] 5.5
## [6,] 6.7
## [7,] 7.9
## [8,] 9.1
## [9,] 10.3
## [10,] 11.5
The 10 most expensive events are:
prop <- df %>%
group_by(EVTYPE) %>%
summarise(
'total cost'= sum(PROPDMG),
) %>%
arrange( desc(`total cost`))
z<-barplot(head(prop$`total cost`, 10),
col='red',
main= 'Most Expensive Events',
names= head(prop$EVTYPE,10),
las=2,
cex.names=.5)
z
## [,1]
## [1,] 0.7
## [2,] 1.9
## [3,] 3.1
## [4,] 4.3
## [5,] 5.5
## [6,] 6.7
## [7,] 7.9
## [8,] 9.1
## [9,] 10.3
## [10,] 11.5
Here, we see that Torados and Flash Floods again top the events. However, wind now comes in third, which isn’t terribly surprising.