From c70981952adf380432d4a551e26e6283a1c0e04d Mon Sep 17 00:00:00 2001 From: Ben Bond-Lamberty Date: Thu, 5 Sep 2024 14:25:59 -0400 Subject: [PATCH] Update sp-slides.qmd --- sp-slides.qmd | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sp-slides.qmd b/sp-slides.qmd index c8d68c5..adaaf6d 100644 --- a/sp-slides.qmd +++ b/sp-slides.qmd @@ -20,11 +20,13 @@ library(readr) library(dplyr) library(tidyr) library(lubridate) +library(gt) library(ggplot2) theme_set(theme_bw()) library(scales) library(viridis) +library(gt) ``` ![Synoptic sites](synoptic/docs/synoptic_sites.png) @@ -69,11 +71,22 @@ dat <- bind_rows(dat) ``` +## Observations + +```{r table} +dat %>% + mutate(Year = year(Date)) %>% + group_by(Year, Site) %>% + summarise(n = sum(n, na.rm = TRUE), .groups = "drop") %>% + pivot_wider(names_from = "Year", values_from = "n", values_fill = 0) %>% + arrange(Site) %>% + gt::gt() %>% + fmt_number(suffixing = "K", decimals = 1) +``` + ## Observations over time ```{r obs-over-time} -#| echo: false - dat %>% complete(Site, Date, research_name, fill = list(rows = 0)) %>% group_by(Site, Date) %>% @@ -166,5 +179,13 @@ ggplot(full_record_vwc, aes(Date, Value, color = Depth, group = Sensor_ID)) + geom_line(na.rm = TRUE, alpha = 0.5) + ylab("TEMPEST Control - soil VWC") + ylim(c(0.1, 0.5)) + +full_record %>% + mutate(Month = month(Date)) %>% + select(-Depth) %>% + pivot_wider(names_from = "research_name", values_from = "Value") %>% + ggplot(aes(soil_temp_15cm, soil_vwc_15cm, color = Month)) + + geom_point(size = 0.4, na.rm = TRUE) + + ylim(c(0.1, 0.5)) + xlim(c(0,25)) ```