Synopsis: Through analyzing the data provided by the NOAA storm database, this project evaluate the severe weather types which cause great population and economic lost across the United States from 1950 to 2011. The total population lost include the fatality and injury amount. The total economic lost includes the lost caused by property damage and crop damage. The evaluation provides the result that TORNADO causes the greatest damage on both population and economics.
Data Processing:
read the file
general_table <- read.csv("repdata_data_StormData.csv")
cache = TRUE
re-arrange the dataset by types
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
grouped_df<-
general_table %>%
group_by(EVTYPE) %>%
summarise(total_fatality = sum(FATALITIES), total_injuries = sum(INJURIES)) %>%
mutate(total_population_damage = total_fatality + total_injuries) %>%
arrange(desc(total_population_damage))
find which event has most damage on population health
weather_population<- grouped_df$EVTYPE[which.max(grouped_df$total_population_damage)]
populationDM_num <- max(grouped_df$total_population_damage)
head(grouped_df,10)
## # A tibble: 10 × 4
## EVTYPE total_fatality total_injuries total_population_damage
## <chr> <dbl> <dbl> <dbl>
## 1 TORNADO 5633 91346 96979
## 2 EXCESSIVE HEAT 1903 6525 8428
## 3 TSTM WIND 504 6957 7461
## 4 FLOOD 470 6789 7259
## 5 LIGHTNING 816 5230 6046
## 6 HEAT 937 2100 3037
## 7 FLASH FLOOD 978 1777 2755
## 8 ICE STORM 89 1975 2064
## 9 THUNDERSTORM WIND 133 1488 1621
## 10 WINTER STORM 206 1321 1527
From the data, we can see TORNADO cause the most population damage across the country. Including both Injuries and Fatalities, the total lost of population caused by TORNADO is 9.6979^{4}
Below is the bar chart of the population damage caused by different severe weather types. The plot only shows the non-zero values.
library(ggplot2)
library(patchwork)
non_zero_value <- grouped_df[grouped_df$total_population_damage != 0,]
plot1<-ggplot(non_zero_value, aes(x = reorder(EVTYPE, total_population_damage, decreasing=TRUE), y = total_population_damage)) +
geom_bar(stat = "identity") +
labs(x = "Weather Types", y = "Damage Num", title = "Severe Weather Damage on Popultaion") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 5))
plot2<-ggplot(non_zero_value[1:10,], aes(x = reorder(EVTYPE, total_population_damage, decreasing=TRUE), y = total_population_damage)) +
geom_bar(stat = "identity") +
labs(x = "Weather Types", y = "Damage Num", title = "Zoomed In Plot") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 5))
combined_plot<-plot1/plot2 + plot_layout(ncol=1,heights = c(1,2))
combined_plot
cache = TRUE
Find the economic lost across different weather types
library(tidyr)
value_df <- general_table %>%
mutate(PROPDMGEXP =
case_when(PROPDMGEXP == "M" ~ 1e6,
PROPDMGEXP == "B" ~ 1e9,
PROPDMGEXP == "K" ~ 1e3,
TRUE ~ as.numeric(PROPDMGEXP))) %>%
mutate(CROPDMGEXP =
case_when(CROPDMGEXP == "M" ~ 1e6,
CROPDMGEXP == "B" ~ 1e9,
CROPDMGEXP == "K" ~ 1e3,
TRUE ~ as.numeric(CROPDMGEXP))) %>%
replace_na(list(PROPDMGEXP=0,CROPDMGEXP=0)) %>%
mutate(PROPDMG_num = PROPDMG * PROPDMGEXP) %>%
mutate(CROPDMG_num = CROPDMG * CROPDMGEXP) %>%
group_by(EVTYPE) %>%
summarise(total_prop_lost = sum(PROPDMG_num), total_crop_lost = sum(CROPDMG_num)) %>%
mutate(total_econ_lost = total_prop_lost + total_crop_lost) %>%
arrange(desc(total_econ_lost))
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `PROPDMGEXP = case_when(...)`.
## Caused by warning:
## ! NAs introduced by coercion
## Warning: There was 1 warning in `mutate()`.
## ℹ In argument: `CROPDMGEXP = case_when(...)`.
## Caused by warning:
## ! NAs introduced by coercion
Find which weather type cause the greatest economic lost
weather_econ<-value_df$EVTYPE[which.max(value_df$total_econ_lost)]
econDM_num <- max(value_df$total_econ_lost)
head(value_df,10)
## # A tibble: 10 × 4
## EVTYPE total_prop_lost total_crop_lost total_econ_lost
## <chr> <dbl> <dbl> <dbl>
## 1 FLOOD 144657709800 5661968450 150319678250
## 2 HURRICANE/TYPHOON 69305840000 2607872800 71913712800
## 3 TORNADO 56925660991 414953110 57340614101
## 4 STORM SURGE 43323536000 5000 43323541000
## 5 HAIL 15727366870 3025537450 18752904320
## 6 FLASH FLOOD 16140812087. 1421317100 17562129187.
## 7 DROUGHT 1046106000 13972566000 15018672000
## 8 HURRICANE 11868319010 2741910000 14610229010
## 9 RIVER FLOOD 5118945500 5029459000 10148404500
## 10 ICE STORM 3944927810 5022113500 8967041310
From the data, we can see FLOOD cause the most economic lost across the country. Including both Property Damage and Crop Damage, the total lost of economics caused by FLOOD is 1.5031968^{11}
Below is the bar chart of the economic lost caused by different severe weather types. The plot only shows the non-zero values.
non_zero_econvalue <-value_df[value_df$total_econ_lost !=0,]
plot3<-ggplot(non_zero_econvalue, aes(x = reorder(EVTYPE, total_econ_lost, decreasing=TRUE), y = total_econ_lost)) +
geom_bar(stat = "identity") +
labs(x = "Weather Types", y = "Lost Num", title = "Severe Weather Damage on Economics") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 5))
plot4<-ggplot(non_zero_econvalue[1:10,], aes(x = reorder(EVTYPE, total_econ_lost, decreasing=TRUE), y = total_econ_lost)) +
geom_bar(stat = "identity") +
labs(x = "Weather Types", y = "Lost Num", title = "Zoomed In Plot") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1, size = 5))
combined_plot_1<-plot3/plot4 + plot_layout(ncol=1,heights = c(1,2))
combined_plot_1
cache = TRUE
Result: From the data, we can see Tornado causes the greatest lost on population and Flood caused the greatest lost on economics through out the years in the United States. Tornado caused 9.6979^{4} of population lost and Flood caused 1.5031968^{11} of economic lost.