Introduction

Rising global average temperature is associated with widespread changes in weather patterns. Scientific studies indicate that extreme weather events such as heat waves and large storms are likely to become more frequent or more intense with human-induced climate change. Long-term changes in climate can directly or indirectly affect many aspects of society in potentially disruptive ways. For example, warmer average temperatures could increase air conditioning costs and affect the spread of diseases like Lyme disease.

More extreme variations in weather are also a threat to society. More frequent and intense extreme heat events can increase illnesses and deaths, especially among vulnerable populations, and damage some crops.

We plan to look at the issue with a focus on North America. We will analyze the average maximum and minimum temperatures from each state in the US and compare it against the historic average temperatures over the last century to see if we can shed light on the issue of extreme weather variation.

References:

https://www.ncdc.noaa.gov/cag/statewide/mapping

https://www.epa.gov/climate-indicators/weather-climate

Analysis

Row

Statewide 2018 Maximum Temperature

Statewide Maximum Temperature Anomaly(1901-2000 period)

Row

Statewide 2018 Minimum Temperature

Statewide Minimum Temperature Anomaly(1901-2000 period)

Row

Max Temp Change Anomaly Plot

Row

Observation

Below are the five main take away points from our research and analysis on climate change and global warming:

U.S.Temperature: Average temperatures have risen in the US since 1901, with an increased rate of warming over the past 30 years. Nine of the top 10 warmest years on record have occurred since 1998. Within the United States, temperatures in parts of the North and the West have increased the most.

Seasonal Temperature: As the Earth warms overall, average temperatures increase throughout the year, but the increases may be larger in certain seasons than in others. Since 1896, average winter temperatures across the US have increased by nearly 3°F. Spring temperatures have increased by about 2°F, while summer and fall temperatures have increased by about 1.5°F.

High and Low Temperatures: Many extreme temperature conditions are becoming more common. Since the 1970s, unusually hot summer days (highs) have become more common over the last few decades in the United States. Unusually hot summer nights (lows) have become more common at an even faster rate. This trend indicates less “cooling off” at night. Although the United States has experienced many winters with unusually low temperatures, unusually cold winter temperatures have become less common—particularly very cold nights (lows). Record-setting daily high temperatures have become more common than record lows.

Heat Waves: Heat waves are occurring more than they used to in major cities across the United States. Heat waves are occurring three times more often than they did in the 1960s—about six per year compared with two per year. The average heat wave season is 49 days longer, and individual heat waves are lasting longer and becoming more intense.

Temperature and Drought in the Southwest: The southwestern United States is particularly sensitive to changes in temperature and thus vulnerable to drought, as even a small decrease in water availability in this already arid region can stress natural systems and further threaten water supplies. Several measures indicate persistent and more severe drought conditions in recent years.

Reference: https://www.epa.gov/climate-indicators/weather-climate

---
title: "Lab2"
output:
  flexdashboard::flex_dashboard:
    orientation: columns
    social: menu
    source_code: embed
    
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

install.packages("maps",repos = "http://cran.us.r-project.org")
install.packages("scatterpie",repos = "http://cran.us.r-project.org")
install.packages("ggiraph",repos = "http://cran.us.r-project.org")
install.packages("dplyr",repos = "http://cran.us.r-project.org")
install.packages("ggplot2",repos = "http://cran.us.r-project.org")
install.packages("plotly",repos = "http://cran.us.r-project.org")
install.packages("rnoaa",repos = "http://cran.us.r-project.org")
install.packages("usmap",repos = "http://cran.us.r-project.org")
install.packages("gdtools",repos = "http://cran.us.r-project.org")
install.packages("readxl",repos = "http://cran.us.r-project.org")

library(maps)
library(scatterpie)
library(ggiraph)
library(dplyr)
library(ggplot2)
library(plotly)
library(rnoaa)
library(usmap)
library(gdtools)
library(readxl)
```

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

Rising global average temperature is associated with widespread changes in weather patterns. Scientific studies indicate that extreme weather events such as heat waves and large storms are likely to become more frequent or more intense with human-induced climate change.
Long-term changes in climate can directly or indirectly affect many aspects of society in potentially disruptive ways. For example, warmer average temperatures could increase air conditioning costs and affect the spread of diseases like Lyme disease.

More extreme variations in weather are also a threat to society. More frequent and intense extreme heat events can increase illnesses and deaths, especially among vulnerable populations, and damage some crops.

We plan to look at the issue with a focus on North America. We will analyze the average maximum and minimum temperatures from each state in the US and compare it against the historic average temperatures over the last century to see if we can shed light on the issue of extreme weather variation.

References:

https://www.ncdc.noaa.gov/cag/statewide/mapping

https://www.epa.gov/climate-indicators/weather-climate

Analysis
=======================================================================

Row {.tabset .tabset-fade data-width=20000}
-----------------------------------------------------------------------
### Statewide 2018 Maximum Temperature  {.no-padding}
```{r,echo = FALSE, message = FALSE}

max_temp <- read.csv("/Users/samanthama/Downloads/Max_Temp.csv")
states = map_data("state")
max_temp$region = tolower(max_temp$Location)
max_temp = merge(states, max_temp, by="region", all=T)
mt = ggplot(max_temp, aes(x = long, y = lat, group = group, fill = Value))+geom_polygon(color = "white")
mt = mt + scale_fill_gradient(name = "degrees F", low = "#feceda", high = "#c81f49", guide = "colorbar", na.value="black") 
mt + coord_map()

```

### Statewide Maximum Temperature Anomaly(1901-2000 period)

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

mta = ggplot(max_temp, aes(x = long, y = lat, group = group, fill = max_temp$Anomaly..1901.2000.base.period.))+geom_polygon(color = "white")
mta = mta + scale_fill_gradient(name = "degrees F", low = "#feceda", high = "#c81f49", guide = "colorbar", na.value="black") 
mta + coord_map()
```

Row {.tabset .tabset-fade data-width=20000}
-----------------------------------------------------------------------
### Statewide 2018 Minimum Temperature  {.no-padding}
```{r,echo = FALSE, message = FALSE}

min_temp <-read.csv("/Users/samanthama/Downloads/Min_Temp.csv")
min_temp$region = tolower(min_temp$Location)
min_temp = merge(states, min_temp, by="region", all=T)
mint = ggplot(min_temp, aes(x = long, y = lat, group = group, fill = Value))+geom_polygon(color = "white")
mint = mint + scale_fill_gradient(name = "degrees F", na.value="black") 
mint + coord_map()

```

### Statewide Minimum Temperature Anomaly(1901-2000 period)

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

minta = ggplot(min_temp, aes(x = long, y = lat, group = group, fill = min_temp$Anomaly..1901.2000.base.period.))+geom_polygon(color = "white")
minta = minta + scale_fill_gradient(name = "degrees F", na.value="black")  
minta + coord_map()


knitr::include_graphics('/Users/samanthama/Downloads/temp_graphing.jpeg')
```

Row {.tabset .tabset-fade data-width=20000}
-----------------------------------------------------------------------
### Max Temp Change Anomaly Plot

```{r, echo=FALSE, message=FALSE}
y = max_temp$Anomaly..1901.2000.base.period.
x = max_temp$Value
plot(x,y, main = "Max Temp Change Anomaly", xlab = "Max Temp", ylab = "Year")

```

Row {.tabset .tabset-fade data-width=600}
-----------------------------------------------------------------------
Observation
=======================================================================

Below are the five main take away points from our research and analysis on climate change and global warming:

U.S.Temperature:
Average temperatures have risen in the US since 1901, with an increased rate of warming over the past 30 years. Nine of the top 10 warmest years on record have occurred since 1998.  Within the United States, temperatures in parts of the North and the West have increased the most. 

Seasonal Temperature:
As the Earth warms overall, average temperatures increase throughout the year, but the increases may be larger in certain seasons than in others. Since 1896, average winter temperatures across the US have increased by nearly 3°F. Spring temperatures have increased by about 2°F, while summer and fall temperatures have increased by about 1.5°F.   

High and Low Temperatures:
Many extreme temperature conditions are becoming more common. Since the 1970s, unusually hot summer days (highs) have become more common over the last few decades in the United States. Unusually hot summer nights (lows) have become more common at an even faster rate. This trend indicates less “cooling off” at night. Although the United States has experienced many winters with unusually low temperatures, unusually cold winter temperatures have become less common—particularly very cold nights (lows). Record-setting daily high temperatures have become more common than record lows. 

Heat Waves:
Heat waves are occurring more than they used to in major cities across the United States. Heat waves are occurring three times more often than they did in the 1960s—about six per year compared with two per year. The average heat wave season is 49 days longer, and individual heat waves are lasting longer and becoming more intense.

Temperature and Drought in the Southwest:
The southwestern United States is particularly sensitive to changes in temperature and thus vulnerable to drought, as even a small decrease in water availability in this already arid region can stress natural systems and further threaten water supplies. Several measures indicate persistent and more severe drought conditions in recent years.

Reference: https://www.epa.gov/climate-indicators/weather-climate