Monthly Land Average Temperature data from 1850 to 2013 is obtained from Berkeley Earth data page (http://berkeleyearth.org/data/)
I also upload the data used in this lab to google drive, feel free to download from https://drive.google.com/file/d/1M9R2Z4gI4IVPF0UgjC4jxjD-7CuxkEsm/view?usp=sharing
I have done two parts visulization of temperature changes from 1850 to 2013: scatterplot and botplot; Average Temperature on the Maps comparison between year 1850 and 2013.
Datasets:
dt: date stamp (monthly data)
AverageTemperature: global average land temperature in celsius
AverageTemperatureUncertainty: the 95% confidence interval around the global average land temperature.
Sate: different Sate/Province across different countries
Country: seven countries in the datasets
Conclution:
From this scatterplot smooth line, we can see that it took almost one century (1850-1950) for average temperature in U.S. to climb from around 10.5 Celsius degree to above 11 Celsius degree.
But it just took a litte bit more than half a century (1950-2013) to hike from 11 Celsius degree to above 12 Celsius degree averagely in U.S.
It illustrates that global warming is trending and intensifying in recent half century in U.S, which already cause the concern globally.
Conclution:
From Boxplot of Average Temperature in 40 Year Intervals 1850-2013, it is quite obvious that average temperature in the last 40 years is increasing dramtically compared with previous four 40 years intervals.
It is pretty apparent that the mean of average temperature in the past 40 years is quite higher than the previous four 40 years intervals, where the mean of average temperature almost keep the same level.
Highlights:
Some states in North area still remain purple for year 1850 like ND, MN, ME, which means average temperature is below 5 Celsius degree.
Some states in South area still remain green for year 1850 like TX, LA, which means average temperature is below 20 Celsius degree.
Highlights:
But states like ND, MN, ME highlighted in year 1850 now turns from purple color to dark blue for year 2013, which means average temperature is above 5 Celsius degree.Land average temperature is warming up in north area broadly.
But states like TX, LA highlighted in year 1850 now turns from green color to light green for year 2013, which means average temperature is above 20 Celsius degree.The same warming up also happened in south areas.
---
title: "Land Average Temperature Changes 1850-2013 in U.S."
author: Jindong Zhao
date: "`r Sys.Date()`"
output:
flexdashboard::flex_dashboard:
orientation: columns
source_code: embed
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
library(dplyr)
library(tidyr)
library(ggplot2)
library(ggthemes)
library(highcharter)
library(viridisLite)
thm <-
hc_theme(
colors = c("#1a6ecc", "#434348", "#90ed7d"),
chart = list(
backgroundColor = "transparent",
style = list(fontFamily = "Source Sans Pro")
),
xAxis = list(
gridLineWidth = 1
)
)
```
```{r read data}
lt_df <- read.csv('GlobalLandTemperaturesByState.csv')
# Filter only for United States, separate 1st Col date into Year, Month and Day
lt_df %>%
filter(Country == "United States") %>%
separate(col = dt, into = c("Year", "Month", "Day"), convert = TRUE) -> lt_df
# Remove Hawaii and Alaska
lt_df %>%
filter(State != "Hawaii" & State != "Alaska") -> lt
# Remove na's
lt <- na.omit(lt)
```
# Data Source
Monthly Land Average Temperature data from 1850 to 2013 is obtained from Berkeley Earth data page (http://berkeleyearth.org/data/)
I also upload the data used in this lab to google drive, feel free to download from
https://drive.google.com/file/d/1M9R2Z4gI4IVPF0UgjC4jxjD-7CuxkEsm/view?usp=sharing
I have done two parts visulization of temperature changes from 1850 to 2013: scatterplot and botplot; Average Temperature on the Maps comparison between year 1850 and 2013.
Datasets:
dt: date stamp (monthly data)
AverageTemperature: global average land temperature in celsius
AverageTemperatureUncertainty: the 95% confidence interval around the global average land temperature.
Sate: different Sate/Province across different countries
Country: seven countries in the datasets
# Average Temperature {.storyboard}
## Column {.tabset .tabset-fade}
### Average Temperature from 1850 to 2013 in U.S.
```{r US Ave Temp}
# filter years later then 1850 as the numbr of states do not change since then
# Group by year to get the mean of temperature for each year
lt %>%
filter(Year > 1850) %>%
group_by(Year) %>%
summarise(Temp = mean(AverageTemperature)) -> lt_1850
ggplot(lt_1850, aes(Year, Temp, color = Temp)) +
geom_point() +
geom_smooth(method = "loess") +
scale_color_gradient(low = "blue", high = "orange") +
labs(title = "Average Temperature from 1850 to 2013 in U.S.",
x = "Year",
y = "Average Temperature") +
theme_economist() +
theme(legend.position = "right")
```
***
Conclution:
- From this scatterplot smooth line, we can see that it took almost one century (1850-1950) for average temperature in U.S. to climb from around 10.5 Celsius degree to above 11 Celsius degree.
- But it just took a litte bit more than half a century (1950-2013) to hike from 11 Celsius degree to above 12 Celsius degree averagely in U.S.
- It illustrates that global warming is trending and intensifying in recent half century in U.S, which already cause the concern globally.
### Average Temperature in 40 Year Intervals 1850-2013
```{r 40Y intervals, fig.width=8, fig.height=6}
# Filter every 40 years interval since 1850
# Then group by Sate, Year
lt %>%
filter(Year == 1850 | Year == 1890 | Year == 1930 | Year == 1970 | Year == 2013) %>%
group_by(State, Year) %>%
summarise(Temp = mean(AverageTemperature)) -> lt_40
# Factor Year for the preparation for the boxplot later
lt_40$Year <- as.factor(lt_40$Year)
# Boxplot of Average Temperature in 40 Year Intervals 1850-2013
ggplot(lt_40, aes(Year, Temp)) +
geom_boxplot(aes(fill = Year)) +
scale_fill_discrete(name = "Year (Every 40Y interval since 1850)") +
labs(x = "Year",
y = "Average Temperature",
title = "Boxplot of Average Temperature in 40 Year Intervals 1850-2013") +
theme_economist() +
theme(legend.position = "right")
```
***
Conclution:
- From Boxplot of Average Temperature in 40 Year Intervals 1850-2013, it is quite obvious that average temperature in the last 40 years is increasing dramtically compared with previous four 40 years intervals.
- It is pretty apparent that the mean of average temperature in the past 40 years is quite higher than the previous four 40 years intervals, where the mean of average temperature almost keep the same level.
# Land Temperature Map {.storyboard}
## Column {.tabset .tabset-fade}
### Land Average Temperature by states in year 1850
```{r 1850map}
# change factor to character for Col State first
lt$State <- as.character(lt$State)
# Make the correction for Sate: Georgia (State), change it to be Georgia
lt$State[lt$State == "Georgia (State)"] <- "Georgia"
# Grou by Year, state for average temperature
lt %>%
select(Year, AverageTemperature, State) %>%
group_by(Year, State) %>%
summarise(AveTemp = mean(AverageTemperature)) -> lt_state_agg
# Rename Col State to be state_full
names(lt_state_agg)[names(lt_state_agg) == "State"] <- "state_full"
# Filter only for Year 1850
lt_state_agg %>%
filter(Year == 1850) -> lt_state_agg_1850
# load usgeojson data from library highcharter
data("usgeojson")
n <- 4
colstops <- data.frame(
q = 0:n/n,
c = substring(viridis(n + 1), 0, 7)) %>%
list_parse2()
# Map for Land Average Temperature by states in year 1850
highchart() %>%
hc_title(text = "Land Average Temperature by states in year 1850") %>%
hc_add_series_map(usgeojson, lt_state_agg_1850, name = "Ave Temp by state",
value = "AveTemp", joinBy = c("woename", "state_full"),
dataLabels = list(enabled = TRUE,
format = '{point.properties.postalcode}')) %>%
hc_colorAxis(stops = colstops) %>%
hc_legend(valueDecimals = 0, valueSuffix = "%") %>%
hc_mapNavigation(enabled = TRUE) %>%
hc_add_theme(thm)
```
***
Highlights:
- Some states in North area still remain purple for year 1850 like ND, MN, ME, which means average temperature is below 5 Celsius degree.
- Some states in South area still remain green for year 1850 like TX, LA, which means average temperature is below 20 Celsius degree.
### Land Average Temperature by states in year 2013
```{r 2013map}
# Filter only for Year 2013
lt_state_agg %>%
filter(Year == 2013) -> lt_state_agg_2013
# Map for Land Average Temperature by states in year 2013
highchart() %>%
hc_title(text = "Land Average Temperature by states in year 2013") %>%
hc_add_series_map(usgeojson, lt_state_agg_2013, name = "Ave Temp by state",
value = "AveTemp", joinBy = c("woename", "state_full"),
dataLabels = list(enabled = TRUE,
format = '{point.properties.postalcode}')) %>%
hc_colorAxis(stops = colstops) %>%
hc_legend(valueDecimals = 0, valueSuffix = "%") %>%
hc_mapNavigation(enabled = TRUE) %>%
hc_add_theme(thm)
```
***
Highlights:
- But states like ND, MN, ME highlighted in year 1850 now turns from purple color to dark blue for year 2013, which means average temperature is above 5 Celsius degree.Land average temperature is warming up in north area broadly.
- But states like TX, LA highlighted in year 1850 now turns from green color to light green for year 2013, which means average temperature is above 20 Celsius degree.The same warming up also happened in south areas.