#Load in DSLabs
library("dslabs")
#choose temp_carbon data
data("temp_carbon")
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.3 v purrr 0.3.4
## v tibble 3.1.0 v dplyr 1.0.4
## v tidyr 1.1.2 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(dplyr)
library(ggplot2)
write_csv(temp_carbon, "temp_carbon.csv", na = "")
summary(temp_carbon)
## year temp_anomaly land_anomaly ocean_anomaly
## Min. :1751 Min. :-0.450 Min. :-0.69000 Min. :-0.46000
## 1st Qu.:1818 1st Qu.:-0.180 1st Qu.:-0.31500 1st Qu.:-0.17000
## Median :1884 Median :-0.030 Median :-0.05000 Median :-0.01000
## Mean :1884 Mean : 0.060 Mean : 0.07086 Mean : 0.05273
## 3rd Qu.:1951 3rd Qu.: 0.275 3rd Qu.: 0.30500 3rd Qu.: 0.25500
## Max. :2018 Max. : 0.980 Max. : 1.50000 Max. : 0.79000
## NA's :129 NA's :129 NA's :129
## carbon_emissions
## Min. : 3.00
## 1st Qu.: 13.75
## Median : 264.00
## Mean :1522.98
## 3rd Qu.:1431.50
## Max. :9855.00
## NA's :4
Notes: temp, land, and ocean are collected from 1880 - 2018 (all collected as mean temperatures in degrees Celsius) Important: Carbon emission in millions of metric tons of carbon from 1751 - 2014
#Prepare data
#Eliminate unmatching dates where anomalies are not recorded (1751 - 1879)
#No recording of carbon emissions after 2014
carbon_starting_1880 <- temp_carbon %>%
filter(year >= 1880 & year <= 2014) %>%
tidyr::gather("anomaly_type", "amount", 2:4)
plot <- ggplot(carbon_starting_1880,aes(x=year,y=carbon_emissions))+ geom_point(size = 1, color = "Red") +
ggtitle("Carbon Emissions from 1880 to 2014")+
xlab("Year")+
ylab("Carbon Emisions") +
theme_gray()
plot
Carbon emissions is measured in million metric tons. In the 2000s, we were at nearly 7500 million metric tons of CO2 emissions.
plot1 <- ggplot(carbon_starting_1880,aes(x=year,y=amount, color = anomaly_type))+ geom_point(size = 1) +
ggtitle("Global mean temp anomaly between 1880 and 2014 (Celsius)")+
xlab("Year")+
ylab("Temperature change") +
theme_gray()
plot1
Over a span of close to 150 years, the amount of carbon emissions has grown to be over 4 times more prevalent in the earth atmosphere as technology and industries are sky rocketing across the glob. This visual shows the direct affect carbon emissions has on the average land temperature, meaning carbon emissions is a climate issue and science is proving that the earth is becoming increasingly warmer due to human interferance.
#Using facet wrap
plot2 <- carbon_starting_1880 %>% ggplot(aes(x = year, y = amount, color = anomaly_type))+
facet_wrap(~anomaly_type)+
geom_line() +
theme_dark()
plot2
In this dataset there are 3 important anomalies. Temp_anomaly, the annual mean temperature in degrees celsius relative to the 20th century mean temperature. Land_anomaly, annual mean temperature on land in degrees celsius and ocean_anomaly, annual mean temperature anomaly of the ocean in degrees celsius. Then there is the carbon emissions which is the annual carbon emissions in millions of metric tons of carbon, an insane amount. In the first visualization, you can clearly see the increase in carbon emissions over the years. To go a bit into the science, in the past nearly 100 years, transportation, industries, electricity, and many other important economis sectors have fastly improved and changed from the early 1900s. However, with this growing changes, humans have released an influx of greenhouse gases into the earths atmosphere. Creating a heat trapper on Earth simply by our own doing. The first visual shows the increase in carbon emissions over the years. To support this idea futher, the most important aspects of our lives: Earth, land, and water, are evaluated on a global scale as to how carbon emissions has truly affected global temperatures. The second scatter plot displays all of the anomalies in relationship to the amount of temperature change over time. Noticing a fairly clear increase as the years go one, supports that the increase in carbon emissions has lead to an increase in temperature on Earth. The ocean, land and overall global mean temperatures have progressively averaged higher and higher giving scientists a clear indication that greenhouse gases are an issue. The main concern right now it what are we going to do about it. The science and data are here to support this global issue but it takes each of us as individuals to recognize this scientific issue and care to come up with a solution.