Skip to content

Commit

Permalink
CS8 final
Browse files Browse the repository at this point in the history
  • Loading branch information
astress32 committed Dec 13, 2024
1 parent 12aee1e commit 533f057
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions week_08/case_study_08_final.Rmd
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")
```

0 comments on commit 533f057

Please sign in to comment.