Climate Disaster by Year

Row

Row

The Most Common and Most Costly

Row

Number of Climate Disasters by Type from 1980 to 2022

Pie Chart

Bar Chart

Row

Average Cost Incurred by Different Types of Climate Disasters from 1980 to 2022

Pie Chart

Bar Chart

Severe Storms and Tropical Cyclones

Now that we have identified Severe Storm and Tropical Cyclone as the two most frequent and most costly climate disaster, let’s take a closer look at them.

Severe Storm

Frequency

Cost

Tropical Cyclone

Frequency

Cost

---
title: "ANLY 512 - Data Explorationand Analysis Laboratory"
author: "Shirong Liu"
date: "`r Sys.Date()`"
output:
  flexdashboard::flex_dashboard:
    orientation: rows
    horizontal_layout: fill
    source: embed
---

```{r setup, include=FALSE}
library(flexdashboard)
library(xts)
library(ggplot2)
library(reshape)
library(reshape2)
```

```{r loading data, include=FALSE}
disaster <- read.csv("Climate_Disaster.csv")

disaster_sum <- data.frame(
  group = c("Drought", "Flooding", "Freeze", "Severe Storm", "Tropical Cyclone", "Wildfire", "Winter Storm"),
  value = c(sum(disaster$Drought.Count),
            sum(disaster$Flooding.Count),
            sum(disaster$Freeze.Count),
            sum(disaster$Severe.Storm.Count),
            sum(disaster$Tropical.Cyclone.Count),
            sum(disaster$Wildfire.Count),
            sum(disaster$Winter.Storm.Count)
            )
  )

disaster_avgCost <- data.frame(
  group = c("Drought", "Flooding", "Freeze", "Severe Storm", "Tropical Cyclone", "Wildfire", "Winter Storm"),
  value = c(mean(disaster$Drought.Cost),
            mean(disaster$Flooding.Cost),
            mean(disaster$Freeze.Cost),
            mean(disaster$Severe.Storm.Cost),
            mean(disaster$Tropical.Cyclone.Cost),
            mean(disaster$Wildfire.Cost),
            mean(disaster$Winter.Storm.Cost)
            )
  )
```

# Climate Disaster by Year
## Row {data-width=250}
```{r, fig.width=12, fig.height=4}
ggplot(disaster, aes(x = Year, y = All.Disasters.Count)) + 
  geom_bar(stat = "identity", fill = "seagreen4") + 
  labs(y = "Number of Climate Disaster", title = "Total Climate Disasters 1980-2022") +
  theme_bw()
```

## Row {data-width=250}
```{r, fig.width=12, fig.height=4}
ggplot(disaster, aes(x = Year, y = All.Disasters.Cost)) + 
  geom_bar(stat = "identity", fill = "seagreen4") + 
  labs(y = "Billions of Dollar", title = "Average Cost") +
  theme_bw()

```

# The Most Common and Most Costly
## Row {data-width=250 .tabset .tabset-fade}
Number of Climate Disasters by Type from 1980 to 2022

### Pie Chart
```{r, fig.width=15}
piechart1 <- ggplot(disaster_sum, aes(x="", y=value, fill=group)) + 
  geom_bar(width = 1, stat = "identity") + 
  coord_polar("y", start=0) +
  scale_fill_brewer(palette="Set3") + 
  theme_bw() + 
  theme(axis.title.x=element_blank(),
        axis.ticks.x=element_blank(),
        axis.title.y=element_blank(),
        axis.ticks.y=element_blank(),
        legend.title=element_blank())
piechart1
```

### Bar Chart
```{r, fig.width=15}
bar1 <- ggplot(disaster_sum, aes(x = group, y = value)) + 
  geom_bar(stat = "identity", fill = "seagreen4") + 
  theme_bw() + 
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) + 
  labs(y = "Total Number of Climate Disaster")
bar1
```

## Row {data-width=250 .tabset .tabset-fade}
Average Cost Incurred by Different Types of Climate Disasters from 1980 to 2022

### Pie Chart
```{r, fig.width=15}
piechart2 <- ggplot(disaster_avgCost, aes(x="", y=value, fill=group)) +
  geom_bar(width = 1, stat = "identity") +
  coord_polar("y", start=0) +
  scale_fill_brewer(palette="Set3") +
  theme_bw() +
  theme(axis.title.x=element_blank(),
        axis.ticks.x=element_blank(),
        axis.title.y=element_blank(),
        axis.ticks.y=element_blank(),
        legend.title=element_blank())
piechart2
```

### Bar Chart
```{r, fig.width=15}
bar2 <- ggplot(disaster_avgCost, aes(x = group, y = value)) + 
  geom_bar(stat = "identity", fill = "seagreen4") + 
  theme_bw() + 
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) + 
  labs(y = "Billions of Dollar")
bar2
```

# Severe Storms and Tropical Cyclones
Now that we have identified Severe Storm and Tropical Cyclone as the two most frequent and most costly climate disaster, let's take a closer look at them.

## Severe Storm {data-width=250 .tabset .tabset-fade}
### Frequency
```{r, fig.width=15}
ggplot(disaster, aes(x = Year, y = Severe.Storm.Count)) + 
  geom_bar(stat = "identity", fill = "coral1") + 
  labs(y = "Count of Severe Storms", title = "Severe Storms 1980-2022") +
  theme_bw()
```

### Cost
```{r, fig.width=15}
ggplot(disaster) + 
  geom_bar(aes(x = Year, y = Severe.Storm.Cost), stat = "identity", fill = "darkolivegreen3") +
  geom_line(aes(x = Year, y = Severe.Storm.Lower.75), size = 0.5, color="coral1", group = 1) + 
  geom_line(aes(x = Year, y = Severe.Storm.Upper.75), size = 0.5, color="coral1", group = 1) + 
  theme_bw() + 
  labs(y = "Billions of Dollars", title = "Cost of Severe Storm with Upper and Lower 75% Bounds")

```

## Tropical Cyclone {data-width=250 .tabset .tabset-fade}
### Frequency
```{r, fig.width=15}
ggplot(disaster, aes(x = Year, y = Tropical.Cyclone.Count)) + 
  geom_bar(stat = "identity", fill = "coral1") + 
  labs(y = "Count of Tropical Cyclones", title = "Tropical Cyclones 1980-2022") +
  theme_bw()
```

### Cost
```{r, fig.width=15}
ggplot(disaster) + 
  geom_bar(aes(x = Year, y = Tropical.Cyclone.Cost), stat = "identity", fill = "darkolivegreen3") +
  geom_line(aes(x = Year, y = Tropical.Cyclone.Lower.75), size = 0.5, color="coral1", group = 1) + 
  geom_line(aes(x = Year, y = Tropical.Cyclone.Upper.75), size = 0.5, color="coral1", group = 1) + 
  theme_bw() + 
  labs(y = "Billions of Dollars", title = "Cost of Tropical Cyclone with Upper and Lower 75% Bounds")

```