The United States (US) National Oceanic and Atmospheric Administration’s (NOAA) NOAA Storm Database is analyzed to provide information about severe weather events. Information about which types of weather events across the United States are most harmful to population health and which types of events across the United States are most costly for the economy is found. Using the data provided, more characteristics of these storms concerning when and where they occur and estimates of any fatalities, injuries, and property damage can be explored to prevent such outcomes to the extent possible. The analysis shows that tornados have the most impact on the population’s health and the nation’s economy.
To process the data, certain libraries have to be loaded to ensure that a proper analysis is done with the information provided by the database.
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.2.3
##
## 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
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.2.3
library(readr)
## Warning: package 'readr' was built under R version 4.2.3
storm_data <- read.csv("repdata-data-StormData.csv")
Then the data can be filtered to remove and rows that may contain missing data.
storm_data <- storm_data %>%
filter(!is.na(EVTYPE) & !is.na(FATALITIES) & !is.na(INJURIES) & !is.na(PROPDMG) & !is.na(CROPDMG))
The total impact for each event type (including information such as sum of fatalities, injuries, property damage, and crop damage) can be calculated. After this, the events can be sorted by total impact.
storm_data_health <- storm_data %>%
group_by(EVTYPE) %>%
summarise(total_impact = sum(FATALITIES, INJURIES))
storm_data_economics <- storm_data %>%
group_by(EVTYPE) %>%
summarise(total_impact = sum(PROPDMG, CROPDMG))
storm_data_health <- storm_data_health %>%
arrange(desc(storm_data_health$total_impact))
storm_data_economics <- storm_data_economics %>%
arrange(desc(storm_data_economics$total_impact))
Sorting through this data will reveal the events with the highest total impact on population health.
top_events_health <- storm_data_health[1:10, ]
print(top_events_health)
## # A tibble: 10 × 2
## EVTYPE total_impact
## <chr> <dbl>
## 1 TORNADO 96979
## 2 EXCESSIVE HEAT 8428
## 3 TSTM WIND 7461
## 4 FLOOD 7259
## 5 LIGHTNING 6046
## 6 HEAT 3037
## 7 FLASH FLOOD 2755
## 8 ICE STORM 2064
## 9 THUNDERSTORM WIND 1621
## 10 WINTER STORM 1527
A bar plot can be created to better visualize this data.
ggplot(top_events_health, aes(x = reorder(EVTYPE, -total_impact), y = total_impact)) +
geom_bar(stat = "identity", fill = "skyblue") +
labs(title = "Top 10 Events with Highest Total Impact on Population Health",
x = "Event Type",
y = "Total Impact on Health (Fatalities and Injuries)") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
This same approach can be used to find the top events with the highest economic consequences.
top_economic_impacts <- storm_data_economics[1:10, ]
print(top_economic_impacts)
## # A tibble: 10 × 2
## EVTYPE total_impact
## <chr> <dbl>
## 1 TORNADO 3312277.
## 2 FLASH FLOOD 1599325.
## 3 TSTM WIND 1445168.
## 4 HAIL 1268290.
## 5 FLOOD 1067976.
## 6 THUNDERSTORM WIND 943636.
## 7 LIGHTNING 606932.
## 8 THUNDERSTORM WINDS 464978.
## 9 HIGH WIND 342015.
## 10 WINTER STORM 134700.
A plot can then be considered in the same way.
ggplot(top_economic_impacts, aes(x = reorder(EVTYPE, -total_impact), y = total_impact)) +
geom_bar(stat = "identity", fill = "skyblue") +
labs(title = "Top 10 Events with Highest Total Impact on Economy",
x = "Event Type",
y = "Total Impact on Economy (Property and Crop Damage)") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))