Kuba
December 3, 2020
Shiny Application and Reproducible Pitch
NOAA Storm data, 1950-2011
The U.S. National Oceanic and Atmospheric Administration (NOAA) collects data on most massive storms and weather events in the US:
The aim is to find out which types of severe weather events are most harmful to population health and have the most significant economic consequences
It can be used for proper government preparation to such events so that to prioritise resources and prevent destructive outcomes to the extent possible
More information can be found at NOAA Storm Events FAQ
library(data.table)
storm <- fread("./data/storm.csv"); storm[,3:8]
BGN_DATE EVTYPE DEATHS INJURIES PROP ($, mln) CROP ($, mln)
1: 1950-04-18 TORNADO 0 15 0.32 0
2: 1950-04-18 TORNADO 0 0 0.00 0
3: 1950-01-13 TORNADO 1 1 0.00 0
4: 1950-02-12 TORNADO 0 0 0.00 0
5: 1950-02-12 TORNADO 0 0 0.32 0
---
702218: 2011-11-30 HIGH WIND 0 0 0.00 0
702219: 2011-11-10 HIGH WIND 0 0 0.00 0
702220: 2011-11-08 HIGH WIND 0 0 0.00 0
702221: 2011-11-09 BLIZZARD 0 0 0.00 0
702222: 2011-11-28 HEAVY SNOW 0 0 0.00 0
danger <- fread("./data/danger.csv"); head(danger)
EVTYPE DEATHS, % INJURIES, % PROP, % CROP, %
1: ASTRONOMICAL LOW TIDE 0.00 0.00 0.00 0.00
2: AVALANCHE 0.24 0.18 0.00 0.00
3: BLIZZARD 0.12 0.92 0.26 0.05
4: COASTAL FLOOD 0.01 0.01 0.13 0.00
5: COLD/WIND CHILL 0.17 0.07 0.02 0.03
6: DEBRIS FLOW 0.05 0.06 0.09 0.00
server.R when Total Harm to Humans plot is selectedlibrary(dplyr); library(ggplot2)
topHARM <- danger %>% transmute(
EVTYPE,`TOTAL_HARM, %`=`DEATHS, %`+`INJURIES, %`,
`DEATHS, %`,`INJURIES, %`) %>%
arrange(desc(`TOTAL_HARM, %`))
topH <- topHARM %>% head(n = 10)
topH <- melt(
select(topH, EVTYPE, `DEATHS, %`, `INJURIES, %`))
topH$EVTYPE <- reorder(topH$EVTYPE, topH$value)
gtopH<- topH %>%
ggplot(aes(x = EVTYPE, y = value,
fill = variable, order = variable)) +
geom_bar(stat="identity") + coord_flip() +
scale_fill_manual(
name="",values =c("firebrick3","springgreen3"))+
xlab("Event Type")+ ylab("Total Harm, %")+
labs(title ="Top-10 DANGERS to HUMANS, %")+
theme(plot.title = element_text(size = rel(0.9)),
axis.line =
element_line(size = 3, colour = "grey80"))