forked from AdamWilsonLabEDU/2024-geo511-spatial-data-science-case-studies-geo511_casestudy_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
title: "Case Study 8" | ||
format: | ||
html: default #website | ||
gfm: default #Github flavored markdown | ||
pptx: default | ||
docx: default | ||
editor: visual | ||
echo: true | ||
author: Abby Stressinger | ||
date: today | ||
--- | ||
|
||
Packages and Libraries | ||
|
||
```{r} | ||
install.packages("knitr") | ||
install.packages("webshot2") # | ||
install.packages("kable") | ||
library(dplyr) | ||
library(ggplot2) | ||
library(tidyverse) | ||
``` | ||
|
||
Data | ||
|
||
```{r} | ||
#Data | ||
#quarto::quarto_render("path/to/file.qmd",output_format = "all") | ||
#Read in CO2 annual mean data | ||
co2_data_url = "ftp://aftp.cmdl.noaa.gov/products/trends/co2/co2_annmean_mlo.txt" | ||
httr:: GET("https://gml.noaa.gov/ccgg/trends/data.html") | ||
co2_data = read.table(file = co2_data_url, sep = " ") | ||
co2_data_2 = co2_data %>% | ||
select("V3", "V6", "V11") | ||
colnames(co2_data_2) = c("Year", "Mean", "Unc") | ||
``` | ||
|
||
Plot | ||
|
||
```{r} | ||
#Plot | ||
#Visualize Co2 levels through time | ||
ggplot(data = co2_data_2, | ||
aes(x = Year, y = Mean)) + | ||
geom_line(color = "red", size = 2) + | ||
theme_minimal() + | ||
labs(title = "Annual Mean Carbon Dioxide Concentrations 1959-Present", subtitle = "Data from NOAA Global Monitoring Laboratory") | ||
``` | ||
|
||
Table | ||
|
||
```{r} | ||
#print top five of table | ||
table <- co2_data_2 %>% | ||
arrange(desc(Mean)) %>% | ||
slice_head(n = 5) | ||
knitr::kable(table, "simple", align = "ccc", caption = "Top Five Annual Mean CO2 Concentrations at Mona Loa") | ||
``` |