This reports contains the results from an anlysis of storm data from the US National Weather Service. Two main questions where asked: What kind of storm causes the most harm to human health and what kind causes the most economic damage? The results indicate that tornados are the number one cause of fatalities or injuries in the United States. For economic damage to property and crops, floods and hurricanes are the tops causes.
The data was downloaded from the US NATIONAL WEATHER SERVICE on July 4th 2020, from the National Oceanic and Atmospheric Administration’s (NOAA) storm database. It was loaded into R using read.csv
data <- read.csv("repdata_data_StormData.csv.bz2")
To calculate the economic data a storm caused, the variables PROPDMGEXP and CROPDMGEXP had to be converted. In it’s raw format, they were coded as exponentials, indicating Kilo, Millon and Billion. The following code was used to recode the characters into corresponding numbers.
The new numbers where then mutiplied with PROPDMG and CROPDMG respectively to calculate the economic damage for either property damage or crop damage.
data <- mutate(data, PROPDMGEXP = recode(PROPDMGEXP,"K"=1000,"M"=1000000,"B"=1000000000,.default=1))
data <- mutate(data, CROPDMGEXP = recode(CROPDMGEXP,"K"=1000,"M"=1000000,"B"=1000000000,.default=1))
data <- mutate(data, NEWPROPDMG= PROPDMGEXP*PROPDMG, NEWCROPDMG = CROPDMGEXP*CROPDMG)
The impact of a storm on the US population health was calculated using both fatalities and injuries. The two where combinied to the a measure of which kind of storm causes the most impact on health in general.
The data was grouped by event type (type of storm) and then the sum of the fatalities and injuries per type where calculated.
The following code and output shows the top 6 results of the anlysis.
datacausalities <- data %>% group_by(EVTYPE)%>%
summarise(Causalities = sum(FATALITIES)+ sum(INJURIES))%>%
arrange(desc(Causalities))
head(datacausalities)
## # A tibble: 6 x 2
## EVTYPE Causalities
## <chr> <dbl>
## 1 TORNADO 96979
## 2 EXCESSIVE HEAT 8428
## 3 TSTM WIND 7461
## 4 FLOOD 7259
## 5 LIGHTNING 6046
## 6 HEAT 3037
top6caus <- head(datacausalities)
ggplot(top6caus, aes(x=EVTYPE, y=Causalities))+
geom_bar(stat="identity")+
labs(title="Impact of weather events on population health", y="Fatalities and injuries",x="Weather Event")
The type of storm that has the highest impact on population health are tornados.
The impact of a storm on the property and crops was calculated using both using a new variable contating the crop or property damage multiplied by its exponential. The two measures of property damage and crop damage where combinied to the a measure of which kind of storm causes the most economic impact.
The data was grouped by event type (type of storm) and then the sum of the property and crop damage per type where calculated.
The following code and output shows the top 6 results of the anlysis.
dataeconomic <- data %>% group_by(EVTYPE)%>%
summarise(PropCropDMG = sum(NEWPROPDMG)+ sum(NEWCROPDMG))%>%
arrange(desc(PropCropDMG))
head(dataeconomic)
## # A tibble: 6 x 2
## EVTYPE PropCropDMG
## <chr> <dbl>
## 1 FLOOD 150319678257
## 2 HURRICANE/TYPHOON 71913712800
## 3 TORNADO 57340614060.
## 4 STORM SURGE 43323541000
## 5 HAIL 18752904943.
## 6 FLASH FLOOD 17562129167.
top6eco <- head(dataeconomic)
ggplot(top6eco, aes(x=EVTYPE, y=PropCropDMG))+
geom_bar(stat="identity")+
labs(title="Impact of weather events on property and crops", y="Property and Crop Damage",x="Weather Event")
The type of storm that has the highest economic impact on property and crops are floods.