This report analyzes the storm database of the U.S. National Oceanic and Atmospheric Administration (NOAA). The dataset documents key characteristics of severe storm events in the United States, as well as the associated deaths, injuries, and property damage. The analysis focuses on two questions: Which type of severe weather event has the greatest impact on public health, and which causes the greatest economic damage? The data analysis involves downloading and importing the CSV file, selecting and preparing the information relevant to the respective questions, and clearly presenting the results graphically. The results of this analysis show that, among the types of events examined, tornadoes cause by far the most severe health and economic consequences. These findings can help raise awareness among policymakers regarding the impacts of severe weather events. Furthermore, they provide a basis for setting priorities in disaster preparedness and for allocating resources more effectively to manage future events.
library(ggplot2)
library(dplyr)
##
## Attache Paket: 'dplyr'
## Die folgenden Objekte sind maskiert von 'package:stats':
##
## filter, lag
## Die folgenden Objekte sind maskiert von 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyr)
As a first step the data is loaded and imported into R Studio. The file used is in bz2- compressed format.
fileUrl <- "https://d396qusza40orc.cloudfront.net/repdata%2Fdata%2FStormData.csv.bz2"
if (!file.exists("StormData.csv.bz2")) {
download.file(fileUrl, "StormData.csv.bz2", method = "curl")
}
storm_data <- read.csv("StormData.csv.bz2")
Across the United States, which types of events (as indicated in the EVTYPE) are most harmful with respect to population health? In the next step, the first question of the assignment is answered. To do this, the dataset is processed to isolate the data related to public health. This information is aggregated with data on fatalities and injuries by event type.
health_data <- storm_data %>% group_by(EVTYPE) %>% summarize(Total_Fatalities = sum(FATALITIES, na.rm = TRUE), Total_Injuries = sum(INJURIES, na.rm = TRUE), Total_Harm = Total_Fatalities + Total_Injuries) %>% arrange(desc(Total_Harm))
top_ten_health_events <- head(health_data, 10)
print(top_ten_health_events)
## # A tibble: 10 × 4
## EVTYPE Total_Fatalities Total_Injuries Total_Harm
## <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
Across the United States, which types of events have the greatest economic consequences? To answer this question, the dataset is processed to isolate the data on economic damage. To do this, property and crop damage are given priority.
economic_data <- storm_data %>% mutate(total_economic_damage = PROPDMG + CROPDMG) %>% group_by(EVTYPE) %>% summarize(Economic_Cost = sum(total_economic_damage, na.rm = TRUE)) %>% arrange(desc(Economic_Cost))
top_ten_economic_events <- head(economic_data, 10)
print(top_ten_economic_events)
## # A tibble: 10 × 2
## EVTYPE Economic_Cost
## <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.
To analyze which types of extreme weather events are most harmful to the population, the total number of fatalities and injuries was calculated for each type of weather event. The results are shown in the following graph. As clearly shown in this figure, Tornados cause by far rhe highest number of casualties (fatalities and injuries combined).
ggplot(top_ten_health_events, aes(x = reorder(EVTYPE, Total_Harm), y = Total_Harm)) + geom_bar(stat = "identity", fill = "darkblue") + coord_flip() + labs(title = "Top 10 most harmful weather events", x = "Event type", y = "Number of Fatalities and Injuries") + theme_classic()
To evaluate economic consequences, the sum of property and crop damages are calculated for each event type. To visualize the findings, the following barplot was created.
ggplot(top_ten_economic_events, aes(x = reorder(EVTYPE, Economic_Cost), y = Economic_Cost)) + geom_bar(stat = "identity", fill = "darkblue") + coord_flip() + labs(title = "Top 10 weather events with most economic consequences", x = "Event type", y = "Total damage cost (in USD)") + theme_classic()