Synopsis

Storms and other severe weather events can cause both public health and economic problems for communities and municipalities. Many severe events can result in fatalities, injuries, and property damage, and preventing such outcomes to the extent possible is a key concern.

This project involves exploring the U.S. National Oceanic and Atmospheric Administration’s (NOAA) storm database. This database tracks characteristics of major storms and weather events in the United States, including when and where they occur, as well as estimates of any fatalities, injuries, and property damage.

To perform this analysis, it is necessary to load some libraries:

library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.2
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.0.2
## 
## 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(statsr)

Loading the data obtained from NOAA:

noaa <- read.csv("repdata-data-StormData.csv")

Data Processing

To start the analysis noaa raw dataset, we are going to summarize the information:

##   STATE__           BGN_DATE BGN_TIME TIME_ZONE COUNTY COUNTYNAME STATE  EVTYPE
## 1       1  4/18/1950 0:00:00     0130       CST     97     MOBILE    AL TORNADO
## 2       1  4/18/1950 0:00:00     0145       CST      3    BALDWIN    AL TORNADO
## 3       1  2/20/1951 0:00:00     1600       CST     57    FAYETTE    AL TORNADO
## 4       1   6/8/1951 0:00:00     0900       CST     89    MADISON    AL TORNADO
## 5       1 11/15/1951 0:00:00     1500       CST     43    CULLMAN    AL TORNADO
## 6       1 11/15/1951 0:00:00     2000       CST     77 LAUDERDALE    AL TORNADO
##   BGN_RANGE BGN_AZI BGN_LOCATI END_DATE END_TIME COUNTY_END COUNTYENDN
## 1         0                                               0         NA
## 2         0                                               0         NA
## 3         0                                               0         NA
## 4         0                                               0         NA
## 5         0                                               0         NA
## 6         0                                               0         NA
##   END_RANGE END_AZI END_LOCATI LENGTH WIDTH F MAG FATALITIES INJURIES PROPDMG
## 1         0                      14.0   100 3   0          0       15    25.0
## 2         0                       2.0   150 2   0          0        0     2.5
## 3         0                       0.1   123 2   0          0        2    25.0
## 4         0                       0.0   100 2   0          0        2     2.5
## 5         0                       0.0   150 2   0          0        2     2.5
## 6         0                       1.5   177 2   0          0        6     2.5
##   PROPDMGEXP CROPDMG CROPDMGEXP WFO STATEOFFIC ZONENAMES LATITUDE LONGITUDE
## 1          K       0                                         3040      8812
## 2          K       0                                         3042      8755
## 3          K       0                                         3340      8742
## 4          K       0                                         3458      8626
## 5          K       0                                         3412      8642
## 6          K       0                                         3450      8748
##   LATITUDE_E LONGITUDE_ REMARKS REFNUM
## 1       3051       8806              1
## 2          0          0              2
## 3          0          0              3
## 4          0          0              4
## 5          0          0              5
## 6          0          0              6

This dataset has 37 variables and 902,297 data. Our interest here is to analyze the relationship between the storm event (EVTYPE) and public health (FATALITIES and INJURIES) and economic problems (PROPDMG and CROPDMG). We are going to create a subset from noaa dataset:

noaa_sub <- subset(noaa, select = c("STATE", "EVTYPE", "FATALITIES", "INJURIES","PROPDMG","CROPDMG"))

##Results

working with the noaa_sub dataset, let’s see the 15 weather events that are harmful to people’s life:

top15 <- noaa_sub %>% group_by(EVTYPE) %>% summarise(total = sum(FATALITIES,INJURIES)) %>% filter(total != 0) %>% arrange(desc(total))
## `summarise()` ungrouping output (override with `.groups` argument)
top15 <- head(top15,15)
rownames(top15) <- c(1:15)
## Warning: Setting row names on a tibble is deprecated.
top15
## # A tibble: 15 x 2
##    EVTYPE            total
##  * <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
## 11 HIGH WIND          1385
## 12 HAIL               1376
## 13 HURRICANE/TYPHOON  1339
## 14 HEAVY SNOW         1148
## 15 WILDFIRE            986

Plotting this values in a barplot:

ggplot(data = top15, aes(x = EVTYPE, y = total, fill=EVTYPE)) + geom_bar(stat = "identity") + coord_flip()

We can see that Tornado is the weather event that bring more danger for health people.

Let’s see now the 15 weather events that bring economic problems:

topeco <- noaa_sub %>% group_by(EVTYPE) %>% summarise(total = sum(PROPDMG,CROPDMG)) %>% filter(total != 0) %>% arrange(desc(total))
## `summarise()` ungrouping output (override with `.groups` argument)
topeco <- head(topeco,15)
rownames(topeco) <- c(1:15)
## Warning: Setting row names on a tibble is deprecated.
topeco
## # A tibble: 15 x 2
##    EVTYPE                total
##  * <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.
## 11 HEAVY SNOW          124418.
## 12 WILDFIRE             88824.
## 13 ICE STORM            67690.
## 14 STRONG WIND          64611.
## 15 HEAVY RAIN           61965.

Plotting in a barplot:

ggplot(data = topeco, aes(x = EVTYPE, y = total, fill = EVTYPE)) + geom_bar(stat="identity") + coord_flip()

In agreement with the prior plot, Tornado brings the highest economic problems for governments.