Introduction

Row

Overview

Climate change and science has been an issue for discussion and debate for at least the last decade. Climate data collection is currently being collected for areas all over the world. Policy decisions are based on the most recent analysis conducted on data extracted from huge online repositories of this data. Due to the inherent growth in the electronic production and storage of information, there is often a feeling of “information overload” or inundation when facing the process of quantitative decision making. As an analyst your job will often be to explore large data sets and develop questions or ideas from visualizations of those data sets.

The ability to synthesize large data sets using visualizations is a skill that all data scientists should have. In addition to this data scientists are called upon to present data syntheses and develop questions or ideas based on their data exploration. This lab should take you through the major steps in data exploration and presentation.

Row

Objective

The objective of this laboratory is to survey the available data, plan, design, and create an information dashboard/presentation that not only explores the data but helps you develop questions based on that data exploration. To accomplish this task you will have to complete a number of steps:

  1. Identify what information interests you about climate change.
  2. Find, collect, organize, and summarize the data necessary to create your data exploration plan.
  3. Design and create the most appropriate visualizations (no less than 5 visualizations) to explore the data and present that information.
  4. Finally organize the layout of those visualizations into a dashboard (use the flexdashboard package) in a way that shows your path of data exploration.
  5. Develop four questions or ideas about climate change from your visualizations.

Four Questions to answer through this analysis

  1. What is the trend of average max temperature in the united states over the past 50 years?
  2. Which months in the united states had greater than 85 degree (F) temp over the past 50 years?
  3. What’s the relationship between average maximum temperature and liquid precipitation?
  4. Have carbon emissions reduced in Washington Dc from historical levels?

Global Climate Overview

Column

Max Temp Trend

MOnths with GT 85F Trend

Correlation between Metrics

Correlation Between Max Temp and Liquid Precipitation

Correlation Between Liquid Precipitation and Cooling Degrees

Washington D.C. Carbon Emissions

Conclusion & Insights

  1. What is the trend of average max temperature in the united states over the past 50 years? Answer: The average max temperature and number of days with maximum temperature >= 90F are trending up. This indicates global climate warming issue.

  2. Which months in the united states had greater than 85 degree (F) temp over the past 50 years? Answer: It is apparent that months preceeding 2015 had higher temperatures, the trend for warmner months (>= 85) is falling after that.

  3. What’s the relationship between average maximum temperature and liquid precipitation? Answer: We are seeing a somehwat negative relationshp here. As global temperatues are rising, drought levels are also rising.

  4. Have carbon emissions reduced in Washington Dc from historical levels? Answer: We are seeing a drastic decline in carbon emission in washington DC over the last 50 years.

Conclusion & Insights: The overall analysis, from global to the city where I live, consistently indicates the fact of global warming is happening and will be worse if no action is taken. Our Earth needs water and ice, from the correlation analysis we can tell the relationship between max temperature and liquid precipitation, that being said, we definitely can try to take some actions, like decrease CO2 emission, replacing fossil fuel with clean energy, planting more etc., to help our Earth.

---
title: "ANLY 512 - LAB 2"
author: "Subhan Khalid"
date: "`r Sys.Date()`"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    Horizontal_layout: fill
    social: menu
    source: embed
    html_document: default
    df_print: paged
    pdf_document: default
---

# Table of Contents {.sidebar}

* Introduction
  
* Global Climate Key Metrics Analysis                         

* Washington D.C. Carbon Emissions

* Conclusion & Insights

# **Introduction**

Row {data-height=230}
-------------------------------------
    
### **Overview** 
Climate change and science has been an issue for discussion and debate for at least the last decade. Climate data collection is currently being collected for areas all over the world. Policy decisions are based on the most recent analysis conducted on data extracted from huge online repositories of this data. Due to the inherent growth in the electronic production and storage of information, there is often a feeling of "information overload" or inundation when facing the process of quantitative decision making. As an analyst your job will often be to explore large data sets and develop questions or ideas from visualizations of those data sets.

The ability to synthesize large data sets using visualizations is a skill that all data scientists should have. In addition to this data scientists are called upon to present data syntheses and develop questions or ideas based on their data exploration. This lab should take you through the major steps in data exploration and presentation.


Row
-------------------------------------
    
### **Objective** 

The objective of this laboratory is to survey the available data, plan, design, and create an information dashboard/presentation that not only explores the data but helps you develop questions based on that data exploration. To accomplish this task you will have to complete a number of steps:
  
1. Identify what information interests you about climate change.
2. Find, collect, organize, and summarize the data necessary to create your data exploration plan.
3. Design and create the most appropriate visualizations (no less than 5 visualizations) to explore the data and present that information.
4. Finally organize the layout of those visualizations into a dashboard (use the flexdashboard package) in a way that shows your path of data exploration.
5. Develop four questions or ideas about climate change from your visualizations.


### **Four Questions to answer through this analysis**

1. What is the trend of average max temperature in the united states over the past 50 years?
2. Which months in the united states had greater than 85 degree (F) temp over the past 50 years?
3. What's the relationship between average maximum temperature and liquid precipitation?
4. Have carbon emissions reduced in Washington Dc from historical levels?


```{r setup, include=FALSE}
library(readxl)
library(flexdashboard)
library(plyr)
library(dplyr)
library(ggplot2)
library(maps)
library(tidyverse)
```

# **Global Climate Overview**

```{r}
temper <- read_csv('C:/Users/sk979/Dropbox/11_HU/07_Semester_2/ANLY 512/05_Lab_2/annual_max_temp.csv')
```

## Column{data-height=900 .tabset .tabset-fade}

### Max Temp Trend {data-width=900}

```{r}
temper %>%
  filter(!is.na(TMAX)) %>%
  ggplot(aes(x=DATE,y=TMAX)) +
       labs(title = "US Average Max Temperature (F) Trend",
  
       subtitle = "From 1970 ~ 2022",
       caption = " Source: National Centers for Environmental Information",
       x = "Year",
       y = "Avg. Max Temperature (F)") +
       geom_line(color="#CD853F", size=2, alpha=0.9) +
       geom_smooth(formula = y ~ x,method='lm', se=FALSE, color='BLUE') 
```


### MOnths with GT 85F Trend {data-width=900}
```{r}
monthly <- read_csv('C:/Users/sk979/Dropbox/11_HU/07_Semester_2/ANLY 512/05_Lab_2/2000_2022_monthly.csv')


monthly_1a <-monthly %>% filter(Value >= 85)


ggplot(monthly_1a, aes(x=Date, y=Value)) + geom_point(size=2, shape=23) + geom_smooth(method=lm,  linetype="dashed",
             color="darkred", fill="blue")+
       labs(title = "US Yearly Scatterplot of Max Temperature >= 85F",

       subtitle = "From 1970 ~ 2022",
       caption = " Source: National Centers for Environmental Information",
       x = "Year",
       y = "Max Temperature >= 85F") 
```

# **Correlation between Metrics**

### Correlation Between Max Temp and Liquid Precipitation

```{r, warning=FALSE}

ggplot(temper,aes(x=TMAX,y=Rain))+
  geom_point(color = "lightblue")+
  geom_smooth(formula = y~x, method = 'lm', color = "red")+
  labs(title = "Correlation Between Avg. Max Temp and Liquid Precipitation",
  
       subtitle = "From 1970 ~ 2022",
       caption = " Source: National Centers for Environmental Information",
       x = "Average Max Temperature (F)",
       y = "Total Liquid Content (Inches)") 

```

### Correlation Between Liquid Precipitation and Cooling Degrees

```{r, warning=FALSE}

ggplot(temper,aes(x=Cooling,y=Rain))+
  geom_point(color = "lightgreen")+
  geom_smooth(formula = y~x, method = 'lm', color = "red")+
  labs(title = "Correlation Between Liquid Precipitation & Cooling Degrees",
  
       subtitle = "From 1970 ~ 2022",
       caption = " Source: National Centers for Environmental Information",
       x = "Cooling Degree (F)",
       y = "Total Liquid Content (Inches)") 

```



# **Washington D.C. Carbon Emissions**

```{r}
DC <- read_csv('C:/Users/sk979/Dropbox/11_HU/07_Semester_2/ANLY 512/05_Lab_2/dc_emissions.csv')

```

```{r warning=FALSE}

ggplot(DC,aes(x=Date,y=Emissions))+ 
    geom_bar(stat="identity", col= 'White', fill='blue')+xlab("Year")+ theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())+ggtitle("DC Annual Carbon Emissions")+ylab("Carbon Emissions")+labs(subtitle = "From 1970 - 2020" , caption = " Source: U.S. Energy Information Admin (EIA)")
  

```

# **Conclusion & Insights**

1. What is the trend of average max temperature in the united states over the past 50 years?
Answer: The average max temperature and number of days with maximum temperature >= 90F are trending up. This indicates global climate warming issue.

2. Which months in the united states had greater than 85 degree (F) temp over the past 50 years?
Answer: It is apparent that months preceeding 2015 had higher temperatures, the trend for warmner months (>= 85) is falling after that.

3. What's the relationship between average maximum temperature and liquid precipitation?
Answer: We are seeing a somehwat negative relationshp here. As global temperatues are rising, drought levels are also rising.

4. Have carbon emissions reduced in Washington Dc from historical levels?
Answer: We are seeing a drastic decline in carbon emission in washington DC over the last 50 years.

Conclusion & Insights:
The overall analysis, from global to the city where I live, consistently indicates the fact of global warming is happening and will be worse if no action is taken. Our Earth needs water and ice, from the correlation analysis we can tell the relationship between max temperature and liquid precipitation, that being said, we definitely can try to take some actions, like decrease CO2 emission, replacing fossil fuel with clean energy, planting more etc., to help our Earth.