Climate Change

Introduction

Climate change is a major environmental threat and likely one of the most important challenges of our time. In particular, climate extremes can have a significant negative effect on society. Yet, many impacts of climate change are poorly understood and binding international climate change agreements are hard to reach.

To understand climate change and extreme weather statistically, we used global surface temperature since 1880, atmospheric carbon dioxide data and extreme weather records in U.S.by State data from State Climate Extremes Committee (SCEC). The file contains data from late 19th century to 2018. It shows records for every state in categories such as temperature, total amount of rain or snow in 24 hours, weight and diameter of hail-storms and highest wind gusts.

Source: NOAA

Global Facts

Row

Global Surface Temperature

Atmospheric Carbon Dioxide

Maximum Temperature

Minimum Temperature

Conclusion and Questions

We can see the temperature of south area is higher than the others.

The bar chart shows that California holds the record for the maximum temperature records followed by Arizona.

The highest temperature over time is seen to be 134 degrees Farenheit in California and appriximately 128 degrees Farenheit in Arizona.

The analysis shows recorded minimum temperature of each state. The chart shows that Alaska has the lowest recorded temperature of -80 Degree Farenheit whereas the minimum recorded temperature in Virgin islands is about 50 degrees Farenheit.

We have three questions based on analysis:

  1. Is there a significant relationship between the extreme temperature in the U.S.and global temperature rise?
  2. How much will earth warm if carbon dioxide double the current levels?
  3. Is there a significant relatonship between latitude and lowest temperature?
---
title: "ANLY 512 LAB 2"
author: "Luoxi Hao "
output: 
  flexdashboard::flex_dashboard:
    storyboard: true
    source: embed
    orientation: columns
    vertical_layout: fill
    df_print: paged
---

```{r setup, include=FALSE}

knitr::opts_chunk$set(echo = FALSE)

library(flexdashboard)
library(knitr)
library(ggplot2)
library(dplyr)
library(plotly)
```

###Climate Change


Introduction
===================================== 

Climate change is a major environmental threat and likely one of the most important challenges of our time. In particular, climate extremes can have a significant negative effect on society. Yet, many impacts of climate change are poorly understood and binding international climate change agreements are hard to reach.

To understand climate change and extreme weather statistically, we used global surface temperature since 1880, atmospheric carbon dioxide data and extreme weather records in U.S.by State data from State Climate Extremes Committee (SCEC). The file contains data from late 19th century to 2018. It shows records for every state in categories such as temperature, total amount of rain or snow in 24 hours, weight and diameter of hail-storms and highest wind gusts.

Source: [NOAA](https://www.climate.gov/maps-data/dataset/extreme-weather-records-state-data-table)



```{r,echo = FALSE, message = FALSE}

library(readxl)
climatedata <- read_excel("C:/Users/lhao/Desktop/records.xlsx")
View(climatedata)


```

Global Facts
=======================================================================

Row {.tabset data-width=1000}
-----------------------------------------------------------------------
### Global Surface Temperature
```{r, echo = FALSE, message = FALSE}
# get data
gmt = read.table("http://climate.nasa.gov/system/internal_resources/details/original/647_Global_Temperature_Data_File.txt", header = TRUE, col.names = c("Year","Annual_Mean","Five_Year_Mean"),skip = 4, nrows=136)

# reformat date 
gmt[,3] = as.numeric(as.character(gmt[,3]))
scaled_gmt = gmt
scaled_gmt[,2] = scale(gmt$Annual_Mean)
scaled_gmt[,3] = scale(gmt$Five_Year_Mean)
scaled_gmt_time_series = ts(scaled_gmt$Five_Year_Mean, frequency = 1, start=c(1880))

# plot
plot(scaled_gmt_time_series, main = "Time Series of Annual 5-Year Mean Temperature Anomalies", xlab = "Year", ylab="Annual 5-Year Mean Temperature Anomaly")
```

### Atmospheric Carbon Dioxide
```{r, echo = FALSE, message = FALSE}
# get data
acd = read.table("ftp://aftp.cmdl.noaa.gov/products/trends/co2/co2_mm_mlo.txt", header = FALSE, col.names = c("Year","Month","Decimal_Date","Average","Interpolated","Trend","Days"), skip = 70)

# reformat date
acd$Average = replace(acd$Average, acd$Average == -99.99, NA)
acd$Days = replace(acd$Days, acd$Days == -1, NA)
scaled_acd = acd
scaled_acd$Interpolated = scale(acd$Interpolated)
scaled_acd_time_series = ts(scaled_acd$Interpolated, frequency = 12, start = c(1958,3))

# plot
plot(scaled_acd_time_series, main = "Monthly Mean Atmospheric Carbon Dioxide Levels", xlab = "Year", ylab="Monthly Mean Atmospheric Carbon Dioxide Level")
```


Maximum Temperature
=======================================================================



```{r,echo = FALSE, message = FALSE}

#Statewide highest temperatures

MaxTemp <- subset(climatedata, climatedata$Element == "All-Time Maximum Temperature")


MaxTempFinal <- MaxTemp [!duplicated(MaxTemp[c(1,4)]),]


Max_temp_g = ggplot(MaxTempFinal, aes(x = State, y = Value)) + 
  geom_bar(aes(fill=State),stat="identity",width = 0.9, 
           position = position_dodge()) + theme_minimal() + 
  xlab("State") + ylab("Temperature (degrees F)") +
  theme(axis.text.x=element_blank(),
      axis.ticks.x=element_blank(),
      plot.background = element_blank()) + 
  ggtitle("Statewide Maximum Temperatures recorded")
ggplotly(Max_temp_g)

```

Minimum Temperature
====================================

```{r, echo = FALSE, message = FALSE}

#Statewide lowest temperatures

MinTemp <- subset(climatedata, climatedata$Element == "All-Time Minimum Temperature")


MinTempFinal <- MinTemp [!duplicated(MinTemp[c(1,4)]),]


Min_temp_g = ggplot(MinTempFinal, aes(x = State, y = Value)) + 
  geom_bar(aes(fill=State),stat="identity",width = 0.9, 
           position = position_dodge()) + theme_minimal() + 
  xlab("State") + ylab("Temperature (degrees F)") +
  theme(axis.text.x=element_blank(),
      axis.ticks.x=element_blank(),
      plot.background = element_blank()) + 
  ggtitle("Statewide Minimum Temperatures recorded")
ggplotly(Min_temp_g)


```

Conclusion and Questions
====================================

We can see the temperature of south area is higher than the others.

The bar chart shows that California holds the record for the maximum temperature records followed by Arizona.

The highest temperature over time is seen to be 134 degrees Farenheit in California and appriximately 128 degrees Farenheit in Arizona.  

The analysis shows recorded minimum temperature of each state. The chart shows that Alaska has the lowest recorded temperature of -80 Degree Farenheit whereas the minimum recorded temperature in Virgin islands is about 50 degrees Farenheit.

We have three questions based on analysis: 

1. Is there a significant relationship between the extreme temperature in the U.S.and global temperature rise?
2. How much will earth warm if carbon dioxide double the current levels? 
3. Is there a significant relatonship between latitude and lowest temperature?