Forest management experiment reveals divergent controls on the sources and age of lateral DOC and CO₂ export in boreal streams

Authors
Affiliation

Audrey Campeau

Université de Montréal & SLU

Alberto Zannella , Karin Eklöf , Mark Garnett, Hjalmar Laudon, Eliza Maher Hasselquist, Marcus B. Wallin.

Published

April 3, 2026

1 Methodology

Figure 1: Schematic of the studied catchment and their treatments

1.1 Study Site and Treatment:

  • The DC sites received different treatments:

    • Forest in all four sites was clearcut - around July 2020.

    • Two sites, DC1 and DC3, were also ditch cleaned - in September 2021.

    • The treatments are named as follow (pristine, clear-cut and ditch cleaning)

  • Site Naming:

    • DC1: FC-DC-1

    • DC2: FC-1

    • DC3: FC-DC-2

    • DC4: FC-2

2 Results

2.1 Figure 2: Timeseries C concentrations and ¹⁴C-content

👈 see code here
# Define operation periods for treatments::::::::::::::::::::::::::::::::::::::::::
predisturbance_start =  as.Date("2020-01-01") 
predisturbance_end = as.Date("2020-07-13")

clearcut_start = as.Date("2020-07-01")
clearcut_end <- as.Date("2020-08-25")

postharvest_start = as.Date("2020-07-14")
postharvest_end= as.Date("2021-09-13")

ditch_cleaning_start <- as.Date("2021-09-01")
ditch_cleaning_end <- as.Date("2021-09-30")

postditch_start = as.Date("2021-09-14")
postditch_end= as.Date("2022-11-01") 





# Timeseries 14C per site, CO2 and DOC seperately
plot_timeseries = function(data, y_var,labs_y, 
                           ymin_rect, ymax_rect) 
  {
  ggplot(data, aes(x=Date, y=!!sym(y_var), 
                   group=Site_id, color=Site_id, 
                   fill=Site_id, shape=Site_id)) +
  
  # Add gray background bars for operations

  annotate("rect", xmin = predisturbance_start, xmax = predisturbance_end,
           ymin = ymin_rect, ymax = ymax_rect,
           fill = "#3CB7CC", alpha = 0.3) +
  
  
    
  annotate("rect", xmin = postharvest_start, xmax = postharvest_end,
           ymin = ymin_rect, ymax = ymax_rect,
           fill = "#32A251", alpha = 0.3) +  
  
  
    
  annotate("rect", xmin = postditch_start, xmax = postditch_end,
           ymin = ymin_rect, ymax = ymax_rect,
           fill = "#FF7F0F", alpha = 0.3) +    
    
  annotate("rect", 
           xmin = clearcut_start, xmax = clearcut_end,
           ymin = ymin_rect, ymax = ymax_rect,
           fill = "#32A251",, alpha = 0.5) +
    
  annotate("rect", 
           xmin = ditch_cleaning_start, xmax = ditch_cleaning_end,
           ymin = ymin_rect, ymax = ymax_rect,
           fill = "#FF7F0F", alpha = 0.5) +
    
    
     geom_line(data=data[!is.na(data[[y_var]]), ]) +
    geom_point(size=3, aes(color = Treatment)) +
    
    scale_x_date(limits=c(as.Date("2020-01-01"), as.Date("2022-11-01")),
                 date_labels = "%b-%Y", date_breaks = "6 months") +
    scale_color_manual(values=c(site_colors))+
    scale_fill_manual(values=alpha(c(site_colors), 0.7))+

    scale_shape_manual(values=c(site_symbols))+
    labs(y=labs_y)+
    
    theme( # set margins to align combined plots 
      plot.margin = margin(5.5, 5.5, 5.5, 5.5, "pt"),
      axis.text.x = element_text(size = 10),
      axis.title.x = element_text(size = 11),
      panel.grid.major = element_line(size = 0.5),
      panel.grid.minor = element_line(size = 0.25)
    )

}



#Concentration timeseries

timeserie_DOC = ggExtra::ggMarginal(
  plot_timeseries(DC_Q, #%>% filter(Site_pairs == "FC")
                   "DOC_mgL", "DOC (mg/L)",
                  ymin_rect=8, ymax_rect=310
                  )+
    # Add text labels for operations
 annotate("text", x = clearcut_start + (clearcut_end - clearcut_start)/2, y = Inf, 
           label = "Forest Harvest operations",
           vjust = 1.2, hjust = 0.5, size = 3.5, color = "black") +
  
  annotate("text", x = ditch_cleaning_start + (ditch_cleaning_end -    ditch_cleaning_start)/2, y = Inf, 
           label = "Ditch cleaning operations",
           vjust = 1.2, hjust = 0.5, size = 3.5, color = "black") +
   labs(y=bquote("DOC (mg C L"^-1*")"))+
   scale_y_log10()+
  #facet_wrap(~Site_pairs)+
  theme(legend.position = "none", axis.title.x = element_blank(), axis.text.x = element_blank()),
  margins=c("y"), type = "boxplot", groupColour = TRUE, groupFill = TRUE )


timeserie_CO2 = ggExtra::ggMarginal(
  plot_timeseries(DC_Q, #%>% filter(Site_pairs == "FC"), 
                  "CO2_mgL", "CO2 (mg/L)",
                  ymin_rect=0.5, ymax_rect=32)+
    labs(y=bquote("CO"[2]*"\n (mg C L"^-1*")"))+
     scale_y_log10()+
 # facet_wrap(~Site_pairs)+
    geom_abline(y=100)+
     theme(legend.position = "none", axis.title.x = element_blank(),axis.text.x = element_blank()),
  margins=c("y"), type = "boxplot", groupColour = TRUE, groupFill = TRUE )

timeserie_14CDOC = ggExtra::ggMarginal(
  plot_timeseries(DC_Q, #%>% filter(Site_pairs == "FC"),
                  "DOC_14C_Modern", "14C-DOC (%)",
                  ymin_rect=-Inf, ymax_rect=Inf)+
  scale_y_continuous(limits=c(95,115))+
  #facet_wrap(~Site_pairs)+
  labs(y = expression(""^14*"C-DOC (% modern)"))+
  geom_hline(yintercept =100, linetype="dotted", color="grey30")+
  theme(legend.position = "none", axis.title.x = element_blank(),
  axis.text.x = element_blank()),
  margins=c("y"), type = "boxplot", groupColour = TRUE, groupFill = TRUE )

timeserie_14CCO2 = ggExtra::ggMarginal(
  plot_timeseries(DC_Q,# %>% filter(Site_pairs == "FC"),
                  "CO2_14C_Modern", "14C-CO2 (%)",
                  ymin_rect=-Inf, ymax_rect=Inf)+
  scale_y_continuous(limits=c(95,115))+
  #facet_wrap(~Site_pairs)+
  geom_hline(yintercept =100, linetype="dotted", color="grey30")+
    labs(y = expression(""^14*"C-CO"[2]*" (% modern)"))+
   theme(legend.position = "none", axis.title.x = element_blank()),
  margins=c("y"), type = "boxplot", groupColour = TRUE, groupFill = TRUE )


# Combine four plots
combined_timeseries= ggarrange(  timeserie_DOC,
                                   timeserie_CO2,
                                   timeserie_14CDOC,
                                  timeserie_14CCO2,
                                  ncol = 1, align='v'#, 
                                 #heights = c( 0.45, 0.55, 0.45, 0.55) #, #labels="AUTO"
                               )
combined_timeseries

C concentration and radiocarbon content timeseries coloured by sites
👈 see code here
ggsave("Output/Figures/Figure2_timeseries.pdf", plot =combined_timeseries, height = 10, width = 12)

2.1.0.1 Dunn’s test | ¹⁴C and [C] ~ Site

👈 see code here
# Calculate medians for each variable by Site_id
combined_medians <- DC_Q %>%
  group_by(Site_id) %>%
  summarise(
    "[DOC]" = round(median(DOC_mgL, na.rm = TRUE), 2),
    "14C-DOC" = round(median(DOC_14C_Modern, na.rm = TRUE),2),
    "[CO2]" = round(median(CO2_mgL, na.rm = TRUE), 2),
    "14C-CO2" = round(median(CO2_14C_Modern, na.rm = TRUE),2),
    .groups = 'drop'
  ) %>%
  rename(Site = Site_id)

knitr::kable(combined_medians, 
             caption = "Median by site for DOC and CO2 concentration and 14C-content")
Median by site for DOC and CO2 concentration and 14C-content
Site [DOC] 14C-DOC [CO2] 14C-CO2
FC_1 39.14 106.82 2.30 104.01
FC_2 44.10 106.70 3.82 101.54
FC_DC1 21.40 106.74 1.65 104.47
FC_DC2 22.05 105.86 1.42 102.99
👈 see code here
library(dunn.test)
library(multcompView)
library(PMCMR)



# Perform the test and get multcomp letters
DOCSites_letters = multcompLetters(get.pvalues(PMCMRplus::kwAllPairsDunnTest(
          DC_Q$DOC_mgL ~ DC_Q$Site_id, p.adjust="bonf")),
          threshold=0.05)$Letters

DOC_14C_Sites_letters = multcompLetters(get.pvalues(PMCMRplus::kwAllPairsDunnTest(
          DC_Q$DOC_14C_Modern ~ DC_Q$Site_id, p.adjust="bonf")),
          threshold=0.05)$Letters
        
CO2Sites_letters = multcompLetters(get.pvalues(PMCMRplus::kwAllPairsDunnTest(
          DC_Q$CO2_mgL ~ DC_Q$Site_id, p.adjust="bonf")),
          threshold=0.05)$Letters

CO2_C14_Sites_letters = multcompLetters(get.pvalues(PMCMRplus::kwAllPairsDunnTest(
          DC_Q$CO2_14C_Modern ~ DC_Q$Site_id, p.adjust="bonf")),
          threshold=0.05)$Letters

        
# Combine into a data frame
combined_dunns_results <- data.frame(
  Site = names(DOCSites_letters),
  "[DOC]" = as.character(DOCSites_letters),
  "14C-DOC" = as.character(DOC_14C_Sites_letters),
  "[CO2]" = as.character(CO2Sites_letters[names(DOCSites_letters)]),
  "14C-CO2" = as.character(CO2_C14_Sites_letters[names(DOCSites_letters)]),
  check.names = FALSE
)

knitr::kable(combined_dunns_results, 
             caption = "Grouping letters for dunn's test result")
Grouping letters for dunn’s test result
Site [DOC] 14C-DOC [CO2] 14C-CO2
FC_1 a a a ab
FC_2 a a b a
FC_DC1 b a c b
FC_DC2 b a c ab

2.2 Figure 3: dotplots

👈 see code here
dotplots_treatment_sites = function(site_pair,variable) {
   ggplot(data = DC_Q %>% filter (Site_pairs==site_pair), 
         aes( y={{ variable }}, color=Treatment, fill = Treatment,
              x=Treatment
              ) )+
  geom_violin(aes(fill=Treatment), alpha=0.5)+
  geom_jitter(alpha=0.8, aes(shape=Site_id))+
  stat_summary(fun = "median", geom = "point", color = "black", size = 2)+
    stat_summary(fun = "median", geom = "line",
                 aes(group = 1), color = "gray30", linewidth = 0.4) +
  scale_color_manual(values = c(treatment_colors)) +
  scale_fill_manual(values = alpha(c(treatment_colors), 0.5)) +
  scale_shape_manual(values= site_symbols)+
 # facet_wrap(~Site_id, nrow=4)+
 # scale_x_discrete(limits = rev)+
  theme(legend.position = "none"
        ,axis.title.x  = element_blank(), axis.text.x = element_blank()
        )
  
}



combined_dotplots = 
  ggarrange(
    dotplots_treatment_sites(site_pair = "FC", variable = DOC_mgL)+
      scale_y_log10(limits=c(8,300)),
    
     dotplots_treatment_sites(site_pair = "FC", variable = DOC_14C_Modern)+
      scale_y_continuous(limits=c(95,115)),
    
    dotplots_treatment_sites(site_pair = "FC", variable = CO2_mgL)+
      scale_y_log10(limits=c(0.8,30)),
    
    dotplots_treatment_sites(site_pair = "FC", variable = CO2_14C_Modern)+
      scale_y_continuous(limits=c(95,115)),
    
   
    
    dotplots_treatment_sites(site_pair = "FC_DC", variable = DOC_mgL)+
      scale_y_log10(limits=c(8,300)),
    
    dotplots_treatment_sites(site_pair = "FC_DC", variable = DOC_14C_Modern)+
      scale_y_continuous(limits=c(95,115)),
    
    dotplots_treatment_sites(site_pair = "FC_DC", variable = CO2_mgL)+
      scale_y_log10(limits=c(0.8,30)),
    
    dotplots_treatment_sites(site_pair = "FC_DC", variable = CO2_14C_Modern)+
      scale_y_continuous(limits=c(95,115)),
    
   
    
    nrow = 2, ncol = 4, align = "hv"
  )
 

combined_dotplots

👈 see code here
ggsave("Output/Figures/Figure3_dotplots.pdf", plot =combined_dotplots, height = 5, width = 12)

2.2.0.1 Dunn’s test | ¹⁴C et [C]~ Treatment

👈 see code here
# Calculate medians for each variable by Site_id
#range (DC_Q$q_int_mmd, na.rm=T)*1000
#range (DC_Q$CO2_14C_Modern, na.rm=T)
#range (DC_Q$DOC_14C_Modern, na.rm=T)
#round(range(c(DC_Q$CO2_14C_Modern-DC_Q$DOC_14C_Modern), na.rm=T),0)

combined_medians <- DC_Q %>%
  group_by(Site_pairs, Treatment) %>%
  summarise(
    "14C-DOC" = round(median(DOC_14C_Modern, na.rm = TRUE),2),
     "[DOC]" = round(median(DOC_mgL, na.rm = TRUE), 2),
    
    "[CO2]" = round(median(CO2_mgL, na.rm = TRUE), 2),
    "14C-CO2" = round(median(CO2_14C_Modern, na.rm = TRUE),2),
     #n = n(),
    .groups = 'drop'
  ) %>%
  rename(Site = Treatment)

knitr::kable(combined_medians, 
             caption = "Median by treatment for DOC and CO2 concentration and 14C-content")
Median by treatment for DOC and CO2 concentration and 14C-content
Site_pairs Site 14C-DOC [DOC] [CO2] 14C-CO2
FC PreDisturbance 105.53 32.02 2.98 99.27
FC PostHarvest 106.73 44.10 2.82 102.26
FC 2yrPostHarvest 107.07 49.30 2.46 103.31
FC_DC PreDisturbance 104.62 16.77 1.26 102.60
FC_DC PostHarvest 106.75 26.15 1.88 103.55
FC_DC PostDrainage 106.49 21.15 1.39 104.30
👈 see code here
library(dunn.test)
library(multcompView)
library(PMCMR)

# Function to perform the test and get multcomp letters
Dunns_letters = function(variable, site_pair) {
  data = DC_Q %>% filter(Site_pairs == site_pair)
  
  multcompLetters(
    get.pvalues(PMCMRplus::kwAllPairsDunnTest(
      data[[variable]] ~ data$Treatment, p.adjust = "bonf")),
    threshold = 0.05)$Letters
}

Dunns_DOC_FC= Dunns_letters(variable = "DOC_mgL", site_pair = "FC")
Dunns_14DOC_FC= Dunns_letters(variable = "DOC_14C_Modern", site_pair = "FC")
Dunns_CO2_FC= Dunns_letters(variable = "CO2_mgL", site_pair = "FC")
Dunns_14CO2_FC= Dunns_letters(variable = "CO2_14C_Modern", site_pair = "FC")

Dunns_DOC_FC_DC=Dunns_letters(variable = "DOC_mgL", site_pair = "FC_DC")
Dunns_14DOC_FC_DC= Dunns_letters(variable = "DOC_14C_Modern", site_pair = "FC_DC")
Dunns_CO2_FC_DC= Dunns_letters(variable = "CO2_mgL", site_pair = "FC_DC")
Dunns_14CO2_FC_DC=Dunns_letters(variable = "CO2_14C_Modern", site_pair = "FC_DC")

        
# Combine into a data frame
combined_dunns_FC <- data.frame(
  Site = names(Dunns_DOC_FC),
  "[DOC]"   = as.character(Dunns_DOC_FC),
  "14C-DOC" = as.character(Dunns_14DOC_FC[names(Dunns_DOC_FC)]),
  "[CO2]"   = as.character(Dunns_CO2_FC[names(Dunns_DOC_FC)]),
  "14C-CO2" = as.character(Dunns_14CO2_FC[names(Dunns_DOC_FC)]),
  check.names = FALSE
)

combined_dunns_FC_DC <- data.frame(
  Site = names(Dunns_DOC_FC_DC),
  "[DOC]"   = as.character(Dunns_DOC_FC_DC),
  "14C-DOC" = as.character(Dunns_14DOC_FC_DC[names(Dunns_DOC_FC_DC)]),
  "[CO2]"   = as.character(Dunns_CO2_FC_DC[names(Dunns_DOC_FC_DC)]),
  "14C-CO2" = as.character(Dunns_14CO2_FC_DC[names(Dunns_DOC_FC_DC)]),
  check.names = FALSE
)

knitr::kable(combined_dunns_FC,
             caption = "Dunn's test grouping letters by treatment — FC sites")
Dunn’s test grouping letters by treatment — FC sites
Site [DOC] 14C-DOC [CO2] 14C-CO2
PreDisturbance a a a a
PostHarvest b a a a
2yrPostHarvest b a a a
👈 see code here
knitr::kable(combined_dunns_FC_DC,
             caption = "Dunn's test grouping letters by treatment — FC_DC sites")
Dunn’s test grouping letters by treatment — FC_DC sites
Site [DOC] 14C-DOC [CO2] 14C-CO2
PreDisturbance a a a a
PostHarvest b a b a
PostDrainage c a a a
👈 see code here
Dotplot_bySite=ggarrange(
  
ggplot(data = DC_Q, 
         aes( y=DOC_mgL, x=Site_id
              ) )+
  geom_violin(aes(fill=Treatment), alpha=0.5)+
  geom_jitter(alpha=0.8, aes(shape=Site_id, color=Treatment, fill = Treatment))+
  stat_summary(fun = "median", geom = "point", color = "black", size = 2)+
    stat_summary(fun = "median", geom = "line",
                 aes(group = 1), color = "gray30", linewidth = 0.4) +
  scale_color_manual(values = c(treatment_colors)) +
  scale_fill_manual(values = alpha(c(treatment_colors), 0.5)) +
  scale_shape_manual(values= site_symbols)+
  facet_wrap(~Treatment_3class, nrow=3)+
  scale_y_log10(limits=c(8,300))+
  theme(legend.position = "none")
        
,
ggplot(data = DC_Q, 
         aes( y=DOC_14C_Modern, 
              x=Site_id
              ) )+
  geom_violin(aes(fill=Treatment), alpha=0.5)+
  geom_jitter(alpha=0.8, aes(shape=Site_id,color=Treatment, fill = Treatment))+
  stat_summary(fun = "median", geom = "point", color = "black", size = 2)+
    stat_summary(fun = "median", geom = "line",
                 aes(group = 1), color = "gray30", linewidth = 0.4) +
  scale_color_manual(values = c(treatment_colors)) +
  scale_fill_manual(values = alpha(c(treatment_colors), 0.5)) +
  scale_shape_manual(values= site_symbols)+
  scale_y_continuous(limits=c(95,115))+
  facet_wrap(~Treatment_3class, nrow=3)+
  theme(legend.position = "none")
,



ggplot(data = DC_Q, 
         aes( y=CO2_mgL, 
              x=Site_id
              ) )+
  geom_violin(aes(fill=Treatment), alpha=0.5)+
  geom_jitter(alpha=0.8, aes(shape=Site_id,color=Treatment, fill = Treatment))+
  stat_summary(fun = "median", geom = "point", color = "black", size = 2)+
    stat_summary(fun = "median", geom = "line",
                 aes(group = 1), color = "gray30", linewidth = 0.4) +
  scale_color_manual(values = c(treatment_colors)) +
  scale_fill_manual(values = alpha(c(treatment_colors), 0.5)) +
  scale_shape_manual(values= site_symbols)+
  facet_wrap(~Treatment_3class, nrow=3)+
  scale_y_log10(limits=c(0.8,30))+
  theme(legend.position = "none")
        #,axis.title.x  = element_blank(), axis.text.x = element_blank()
        #)

,
ggplot(data = DC_Q, 
         aes( y=CO2_14C_Modern, 
              x=Site_id
              ) )+
  geom_violin(aes(fill=Treatment), alpha=0.5)+
  geom_jitter(alpha=0.8, aes(shape=Site_id,color=Treatment, fill = Treatment))+
  stat_summary(fun = "median", geom = "point", color = "black", size = 2)+
    stat_summary(fun = "median", geom = "line",
                 aes(group = 1), color = "gray30", linewidth = 0.4) +
  scale_color_manual(values = c(treatment_colors)) +
  scale_fill_manual(values = alpha(c(treatment_colors), 0.5)) +
  scale_shape_manual(values= site_symbols)+
  facet_wrap(~Treatment_3class, nrow=3)+
  scale_y_continuous(limits=c(95,115))+
  #scale_y_log10()+
  theme(legend.position = "none")
        #,axis.title.x  = element_blank(), axis.text.x = element_blank()
        #)

,
ncol=4, common.legend = F)

Dotplot_bySite

👈 see code here
ggsave("Output/Figures/Figure3_dotplots_bysite.pdf", plot =Dotplot_bySite, height = 7, width = 12)
👈 see code here
library(dunn.test)
library(multcompView)
library(PMCMR)
levels(DC_Q$Treatment_3class)
[1] "PreDisturbance"         "PostHarvest"            "PostDrain_2yrsPostHarv"
👈 see code here
# Function to perform the test and get multcomp letters
Dunns_letters = function(variable, treatment) {
  data = DC_Q %>% filter(Treatment_3class == treatment)
  
  multcompLetters(
    get.pvalues(PMCMRplus::kwAllPairsDunnTest(
      data[[variable]] ~ data$Site_id, p.adjust = "bonf")),
    threshold = 0.05)$Letters
}

Dunns_DOC_PreDisturbance= Dunns_letters(variable = "DOC_mgL", treatment = "PreDisturbance")
Dunns_14DOC_PreDisturbance= Dunns_letters(variable = "DOC_14C_Modern", treatment = "PreDisturbance")
Dunns_CO2_PreDisturbance= Dunns_letters(variable = "CO2_mgL", treatment = "PreDisturbance")
Dunns_14CO2_PreDisturbance= Dunns_letters(variable = "CO2_14C_Modern", treatment = "PreDisturbance")



Dunns_DOC_PostHarvest=Dunns_letters(variable = "DOC_mgL", treatment = "PostHarvest")
Dunns_14DOC_PostHarvest= Dunns_letters(variable = "DOC_14C_Modern", treatment = "PostHarvest")
Dunns_CO2_PostHarvest= Dunns_letters(variable = "CO2_mgL", treatment = "PostHarvest")
Dunns_14CO2_PostHarvest=Dunns_letters(variable = "CO2_14C_Modern", treatment = "PostHarvest")



Dunns_DOC_PostDrain_2yrsPostHarv=Dunns_letters(variable = "DOC_mgL", treatment = "PostDrain_2yrsPostHarv")
Dunns_14DOC_PostDrain_2yrsPostHarv= Dunns_letters(variable = "DOC_14C_Modern", treatment = "PostDrain_2yrsPostHarv")
Dunns_CO2_PostDrain_2yrsPostHarv= Dunns_letters(variable = "CO2_mgL", treatment = "PostDrain_2yrsPostHarv")
Dunns_14CO2_PostDrain_2yrsPostHarv=Dunns_letters(variable = "CO2_14C_Modern", treatment = "PostDrain_2yrsPostHarv")

        
# Combine into a data frame
combined_dunns_PreDisturbance <- data.frame(
  Site = names(Dunns_DOC_PreDisturbance),
  "[DOC]"   = as.character(Dunns_DOC_PreDisturbance),
  "14C-DOC" = as.character(Dunns_14DOC_PreDisturbance[names(Dunns_DOC_PreDisturbance)]),
  "[CO2]"   = as.character(Dunns_CO2_PreDisturbance[names(Dunns_DOC_PreDisturbance)]),
  "14C-CO2" = as.character(Dunns_14CO2_PreDisturbance[names(Dunns_DOC_PreDisturbance)]),
  check.names = FALSE
)

combined_dunns_PostHarvest <- data.frame(
  Site = names(Dunns_DOC_PostHarvest),
  "[DOC]"   = as.character(Dunns_DOC_PostHarvest),
  "14C-DOC" = as.character(Dunns_14DOC_PostHarvest[names(Dunns_DOC_PostHarvest)]),
  "[CO2]"   = as.character(Dunns_CO2_PostHarvest[names(Dunns_DOC_PostHarvest)]),
  "14C-CO2" = as.character(Dunns_14CO2_PostHarvest[names(Dunns_DOC_PostHarvest)]),
  check.names = FALSE
)

combined_dunns_PostDrain_2yrsPostHarv <- data.frame(
  Site = names(Dunns_DOC_PostDrain_2yrsPostHarv),
  "[DOC]"   = as.character(Dunns_DOC_PostDrain_2yrsPostHarv),
  "14C-DOC" = as.character(Dunns_14DOC_PostDrain_2yrsPostHarv[names(Dunns_DOC_PostDrain_2yrsPostHarv)]),
  "[CO2]"   = as.character(Dunns_CO2_PostDrain_2yrsPostHarv[names(Dunns_DOC_PostDrain_2yrsPostHarv)]),
  "14C-CO2" = as.character(Dunns_14CO2_PostDrain_2yrsPostHarv[names(Dunns_DOC_PostDrain_2yrsPostHarv)]),
  check.names = FALSE
)


knitr::kable(combined_dunns_PreDisturbance,
             caption = "Dunn's test grouping letters by site — Predisturbance conditions")
Dunn’s test grouping letters by site — Predisturbance conditions
Site [DOC] 14C-DOC [CO2] 14C-CO2
FC_1 a a ab NA
FC_2 a a a a
FC_DC1 b a bc a
FC_DC2 b a c a
👈 see code here
knitr::kable(combined_dunns_PostHarvest,
             caption = "Dunn's test grouping letters by site — post-Harvest conditions")
Dunn’s test grouping letters by site — post-Harvest conditions
Site [DOC] 14C-DOC [CO2] 14C-CO2
FC_1 a a a a
FC_2 a a b a
FC_DC1 b a c a
FC_DC2 b a c a
👈 see code here
knitr::kable(combined_dunns_PostDrain_2yrsPostHarv,
             caption = "Dunn's test grouping letters by site — PostDrain_2yrsPostHarv conditions")
Dunn’s test grouping letters by site — PostDrain_2yrsPostHarv conditions
Site [DOC] 14C-DOC [CO2] 14C-CO2
FC_1 a a a a
FC_2 a a a a
FC_DC1 b a b a
FC_DC2 b a b a

2.3 Figure 4: Scatterplot [C] or ¹⁴C-content by treatment

👈 see code here
# Make plot function for DOC vs CO2 concentrations
density_Cscatter_pairs = function() { #site_pair
 # ggExtra::ggMarginal(
    ggplot(data = DC_Q,# %>% filter(Site_pairs == site_pair),
           aes(x = DOC_mgL, y = CO2_mgL_filled, 
               color = Treatment, fill = Treatment)) +
      #stat_density_2d(aes(fill = Treatment), geom = "polygon", linewidth = 0,
      #                alpha = 0.15) +
      geom_point(aes(shape = Site_id), size = 2) +
      geom_smooth(method = "lm", se = F, aes(color = Treatment), show.legend = F) +
     # stat_regline_equation(label.y.npc = "top", label.x.npc = "left",
      #                      aes(label = paste(..eq.label.., ..adj.rr.label..,
      #                                        sep = "~~~~"), color = Treatment),
      #                      show.legend = F, size = 3) +
      scale_shape_manual(values = c(site_symbols)) +
      scale_color_manual(values = c(treatment_colors)) +
      scale_fill_manual(values = alpha(c(treatment_colors), 0.5)) +
      scale_y_log10(limits = c(range(DC_Q$CO2_mgL_filled, na.rm = T))) +
      scale_x_log10(limits = c(range(DC_Q$DOC_mgL_filled, na.rm = T))) +
      labs(x = bquote("DOC (mg L"^-1*")"),
           y = bquote("CO"[2]*" (mg L"^-1*")")) +
      theme(legend.position = "none")#,
   # type = "boxplot", groupColour = TRUE, groupFill = TRUE
  #)
}

# Create plots for both site pair
density_Cscatter_sites_FC    = density_Cscatter_pairs() #c("FC","FC_DC")
#density_Cscatter_sites_FC_DC = density_Cscatter_pairs("FC_DC")

#density_Cscatter_sites_FC


# Make a plot function for 14C-DOC vs 14C-CO2 
density_14Cscatter_pairs = function() { #site_pair
#ggExtra::ggMarginal(
            ggplot(data=DC_Q, #%>% filter (Site_pairs==site_pair),
              aes(x=DOC_14C_Modern, y=CO2_14C_Modern, 
                    color=Treatment, fill=Treatment, shape=Site_id))+
              geom_abline(intercept=0,slope=1, linetype="dashed", color="gray30")+
            #   stat_density_2d(aes(fill = Treatment), geom = "polygon", linewidth=0,
             #                alpha = 0.2)+ 
              geom_segment(aes(xend = DOC_14C_Modern, yend = DOC_14C_Modern), 
                 alpha = 0.5, linetype = "solid", size = 0.5) +
            geom_point(aes(shape=Site_id),size=2)+
            scale_shape_manual(values=c(site_symbols))+
            scale_color_manual(values=c(treatment_colors))+
            scale_fill_manual(values=alpha(c(treatment_colors), 0.7))+
            scale_y_continuous(limit=c(95,115))+
            scale_x_continuous(limit=c(95,115))+
            labs(x=bquote(Delta^14*"C-DOC (% modern)"), 
                   y=bquote(Delta^14*"C-CO"[2]*" (% modern)"))+
              theme(legend.position = "none")#, 
   #         type = "boxplot", groupColour = T, groupFill = T )
            
}
  
density_14Cscatter_treatment_FC = density_14Cscatter_pairs() #c("FC","FC_DC")
#density_14Cscatter_treatment_FC_DC = density_14Cscatter_pairs("FC_DC")
    

combined_CO2DOCscattters= ggarrange(density_Cscatter_sites_FC,  #density_Cscatter_sites_FC_DC, 
          density_14Cscatter_treatment_FC,  #density_14Cscatter_treatment_FC_DC,
 nrow=2, ncol=1, align="hv",labels="AUTO")

combined_CO2DOCscattters

relationship between C concentration and radiocarbon content of CO2 and DOC coloured by treatment
👈 see code here
ggsave("Output/Figures/Figure4_CO2DOC_scatters.pdf", plot =combined_CO2DOCscattters,
       height= 8, width = 4.5)

2.3.0.1 Linear regression & ANCOVA | [CO2] ~ [DOC] / Treatment

👈 see code here
# Function to extract lm results for one treatment group within a site_pair
extract_lm_results <- function() { #site_pair
  DC_Q %>%
    #filter(Site_pairs == site_pair) %>%
    group_by(Treatment) %>%
    group_map(~ {
      model <- lm(log10(CO2_mgL_filled) ~ log10(DOC_mgL), data = .x)
      s <- summary(model)
      coefs <- coef(model)
      f <- s$fstatistic
      p_val <- pf(f[1], f[2], f[3], lower.tail = FALSE)
      
     tibble(
        #Site_pair  = site_pair,
        Treatment  = .y$Treatment,
        Intercept  = round(coefs[1], 3),
        Slope      = round(coefs[2], 3),
        R2_adj     = round(s$adj.r.squared, 3),
        P_value    = signif(p_val, 3)#,
        #n          = nrow(.x)
      )
    }) %>%
    bind_rows()
}

# Run for both site pairs
lm_results_table = extract_lm_results()
  #bind_rows(
  #extract_lm_results("FC"),
 # extract_lm_results("FC_DC")
#)

knitr::kable(lm_results_table,
             caption = "Linear regression results (log10-log10) of CO2 vs DOC by treatment and site pair")
Linear regression results (log10-log10) of CO2 vs DOC by treatment and site pair
Treatment Intercept Slope R2_adj P_value
PreDisturbance -1.032 0.986 0.549 0.00e+00
PostHarvest -0.642 0.649 0.475 0.00e+00
PostDrainage 0.060 0.077 -0.013 5.98e-01
2yrPostHarvest -0.918 0.799 0.424 3.30e-06
👈 see code here
#Run ANCOVA test - Difference in hydro. response between treatments


knitr::kable(
  DC_Q %>%
    #filter(Site_pairs == "FC") %>%
    mutate(log_DOC = log10(DOC_mgL),
           log_CO2 = log10(CO2_mgL_filled)) %>%
    anova_test(log_DOC ~ log_CO2 * Treatment),
  caption = "ANCOVA results: log10(DOC) ~ log10(CO2) × Treatment — FC sites"
)
ANCOVA results: log10(DOC) ~ log10(CO2) × Treatment — FC sites
Effect DFn DFd F p p<.05 ges
log_CO2 1 296 214.852 0.00e+00 * 0.421
Treatment 3 296 37.607 0.00e+00 * 0.276
log_CO2:Treatment 3 296 7.610 6.43e-05 * 0.072
👈 see code here
#knitr::kable(
#  DC_Q %>%
    #filter(Site_pairs == "FC_DC") %>%
#    mutate(log_DOC = log10(DOC_mgL),
#           log_CO2 = log10(CO2_mgL_filled)) %>%
#    anova_test(log_DOC ~ log_CO2 * Treatment),
#  caption = "ANCOVA results: log10(DOC) ~ log10(CO2) × Treatment — FC_DC sites"
#)

2.4 Figure 5: 14C ~ Q relationship

👈 see code here
#Scatter coloured by Treatment


#14C-DOC -q scatter
#DOC_Q_scatters_pairs = function(site_pair) {
  
plot_DOC_q= ggplot(DC_Q,# %>% #filter(!is.na(DOC_14C_Modern))%>%
         #filter (Site_pairs==site_pair),
                   aes(y = DOC_14C_Modern, x = q_int_mmd, 
                       fill = Treatment, color = Treatment)) +
  geom_point(aes(shape = Site_id), size = 3, show.legend = F) +
  geom_smooth(method = "lm", se = F, aes(color = Treatment), show.legend = F,size=0.75) +
  
  scale_shape_manual(values = site_symbols) +
  scale_fill_manual(values = alpha(treatment_colors),0.7) + 
  scale_color_manual(values = treatment_colors) + 
  scale_x_continuous(limits = c(0, 20)) +
  scale_y_continuous(limits = c(97.5, 110)) +
  stat_regline_equation(
    label.y.npc = "top", label.x.npc = "left",
    aes(label = paste(..eq.label.., ..adj.rr.label.., sep = "~~~~"), 
        color = Treatment), 
    show.legend = F, size = 4) +
  labs(x = "", 
       y = bquote("" ^14*"C-DOC (% modern)")) +
  theme(legend.position = "none")  

#}


#  plot_DOC_q_FC = DOC_Q_scatters_pairs("FC") 
#   plot_DOC_q_FC_DC = DOC_Q_scatters_pairs("FC_DC")
  
  
#14C-CO2 -q scatter
#CO2_Q_scatters_pairs = function(site_pair) { 
plot_CO2_q=  ggplot(DC_Q,# %>% #filter(!is.na(CO2_14C_Modern))%>%
          #filter (Site_pairs==site_pair),
                   aes(y = CO2_14C_Modern, x = q_int_mmd, 
                       fill = Treatment, color = Treatment)) +
  geom_point(aes(shape = Site_id), size = 3, show.legend = F) +
  geom_smooth(method = "lm", se = F, aes(color = Treatment), 
              show.legend = F, size=0.75) +
  scale_shape_manual(values = site_symbols) +
  scale_fill_manual(values = alpha(treatment_colors),0.7) + 
  scale_color_manual(values = treatment_colors) + 
  scale_x_continuous(limits = c(0, 20)) +
    scale_y_continuous(limits = c(95, 115)) +
  stat_regline_equation(
    label.y.npc = "top", label.x.npc = "left",
    aes(label = paste(..eq.label.., ..adj.rr.label.., sep = "~~~~"), 
        color = Treatment), 
    show.legend = F, size = 4) +
  labs(x = "", 
       y = bquote("" ^14*"C-CO"[2]*" (% modern)")) +
  theme(legend.position = "right")
#}

#plot_CO2_q_FC = CO2_Q_scatters_pairs("FC") 
#plot_CO2_q_FC_DC = CO2_Q_scatters_pairs("FC_DC")


combined_14C_q=ggarrange( plot_DOC_q, #plot_DOC_q_FC_DC, 
           plot_CO2_q,# plot_CO2_q_FC_DC, 
           labels = "AUTO", nrow=2, align = "hv")


combined_14C_q

relationship between radiocarbon content of CO2 and DOC and discharge, coloured by treatment
👈 see code here
ggsave("Output/Figures/Figure5_14C_q_scatters.pdf", plot =combined_14C_q,
       height= 8, width = 4.5)
👈 see code here
# --- Linear regression tables ---

extract_lm_results_14C <- function(y_var) { #site_pair
  DC_Q %>%
    #filter(Site_pairs == site_pair) %>%
    group_by(Treatment) %>%
    group_map(~ {
      model <- lm(.x[[y_var]] ~ .x$q_int_mmd)
      s <- summary(model)
      coefs <- coef(model)
      f <- s$fstatistic
      p_val <- if (!is.null(f)) pf(f[1], f[2], f[3], lower.tail = FALSE) else NA
      
      tibble(
        #Site_pair  = site_pair,
        Treatment  = .y$Treatment,
        Response   = y_var,
        Intercept  = round(coefs[1], 3),
        Slope      = round(coefs[2], 3),
        R2_adj     = round(s$adj.r.squared, 3),
        P_value    = signif(p_val, 3),
        n          = nrow(.x)
      )
    }) %>%
    bind_rows()
}

# Extract for all combinations
lm_14C_results <- bind_rows(
  extract_lm_results_14C( y_var=  "DOC_14C_Modern"),
  #extract_lm_results_14C("FC_DC",  y_var=  "DOC_14C_Modern"),
  extract_lm_results_14C( y_var= "CO2_14C_Modern"),
  #extract_lm_results_14C("FC_DC",  y_var=  "CO2_14C_Modern")
)

knitr::kable(lm_14C_results,
             caption = "Linear regression results: 14C ~ discharge by treatment and site pair")
Linear regression results: 14C ~ discharge by treatment and site pair
Treatment Response Intercept Slope R2_adj P_value n
PreDisturbance DOC_14C_Modern 102.845 0.372 0.046 0.308000 785
PostHarvest DOC_14C_Modern 104.644 0.502 0.631 0.000246 1706
PostDrainage DOC_14C_Modern 105.754 0.174 0.468 0.017400 948
2yrPostHarvest DOC_14C_Modern 106.447 0.086 0.181 0.122000 948
PreDisturbance CO2_14C_Modern 103.289 -0.648 0.218 0.430000 785
PostHarvest CO2_14C_Modern 102.085 0.304 0.068 0.179000 1706
PostDrainage CO2_14C_Modern 104.873 -0.017 -0.123 0.918000 948
2yrPostHarvest CO2_14C_Modern 105.678 -0.128 -0.054 0.484000 948
👈 see code here
# --- ANCOVA tables ---

# 14C-DOC
knitr::kable(
  DC_Q %>%
    filter( !is.na(DOC_14C_Modern)) %>% #Site_pairs == "FC",
    anova_test(DOC_14C_Modern ~ q_int_mmd * Treatment),
  caption = "ANCOVA results: 14C-DOC ~ discharge × Treatment"
)
Warning: NA detected in rows: 10,22,34,46.
Removing this rows before the analysis.
ANCOVA results: 14C-DOC ~ discharge × Treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 34 13.364 0.000858 * 0.282
Treatment 3 34 4.279 0.011000 * 0.274
q_int_mmd:Treatment 3 34 3.122 0.039000 * 0.216
👈 see code here
#knitr::kable(
#  DC_Q %>%
#    filter(Site_pairs == "FC_DC", !is.na(DOC_14C_Modern)) %>%
#    anova_test(DOC_14C_Modern ~ q_int_mmd * Treatment),
#  caption = "ANCOVA results: 14C-DOC ~ discharge × Treatment — FC_DC sites"
#)

# 14C-CO2
knitr::kable(
  DC_Q %>%
    filter( !is.na(CO2_14C_Modern)) %>% #Site_pairs == "FC",
    anova_test(CO2_14C_Modern ~ q_int_mmd * Treatment),
  caption = "ANCOVA results: 14C-CO2 ~ discharge × Treatment"
)
Warning: NA detected in rows: 9,20,31,42.
Removing this rows before the analysis.
ANCOVA results: 14C-CO2 ~ discharge × Treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 30 0.534 0.471 0.017
Treatment 3 30 1.487 0.238 0.129
q_int_mmd:Treatment 3 30 0.855 0.475 0.079
👈 see code here
#knitr::kable(
#  DC_Q %>%
#    filter(Site_pairs == "FC_DC", !is.na(CO2_14C_Modern)) %>%
#    anova_test(CO2_14C_Modern ~ q_int_mmd * Treatment),
#  caption = "ANCOVA results: 14C-CO2 ~ discharge × Treatment — FC_DC sites"
#)

2.4.0.1 ANCOVA tests

Ancova test results: 14C-DOC ~ q x Treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 34 13.364 0.000858 * 0.282
Treatment 3 34 4.279 0.011000 * 0.274
q_int_mmd:Treatment 3 34 3.122 0.039000 * 0.216
ANCOVA test results, 14C-DOC * q x Site
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 34 12.846 0.001 * 0.274
Site_id 3 34 1.042 0.386 0.084
q_int_mmd:Site_id 3 34 1.477 0.238 0.115
Ancova test results: 14C-CO2 ~ q x Treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 30 0.534 0.471 0.017
Treatment 3 30 1.487 0.238 0.129
q_int_mmd:Treatment 3 30 0.855 0.475 0.079

2.5 Figure 6: Keeling plots - CO2

👈 see code here
DC_Q$CO2_mgL_filled_keeling= 1/DC_Q$CO2_mgL_filled
DC_Q$CO2_mgL_filled_keeling = ifelse(is.infinite (DC_Q$CO2_mgL_filled_keeling), NA, DC_Q$CO2_mgL_filled_keeling)



# Create Keeling plot for 14C-CO2
plot_14C <- ggplot(DC_Q %>% filter(!is.na(CO2_14C_Modern)),
                   #%>% filter (Site_pairs=="FC_DC"), 
                   aes(y=CO2_14C_Modern, x=CO2_mgL_filled_keeling
                       )) +
  geom_smooth(method="lm", se=F, show.legend = F,size=0.75, color="black") + 
  geom_point(aes(shape=Site_id, color=Treatment, fill=Treatment), size=3) +
  stat_regline_equation(
    label.y.npc = "top", label.x.npc = "left",
    aes(label = paste(..eq.label.., ..adj.rr.label.., sep = "~~~~")), 
    show.legend = F, size=4) +
  scale_color_manual(values = treatment_colors) +
  scale_fill_manual(values = treatment_colors) +
  scale_shape_manual(values = site_symbols) +
  scale_x_continuous(limits=c(0,1.15))+
  labs(x = "", y = expression(""^14*"C-CO"[2]*" (% modern)")) +
  theme(legend.position = "none")



# Create Keeling plot for d13C-CO2
plot_d13C <- ggplot(DC_Q %>% filter(!is.na(d13C_CO2)),
                         #%>% filter (Site_pairs=="FC_DC"), 
                    aes(y=d13C_CO2, x=CO2_mgL_filled_keeling 
                        )) +
  geom_smooth(method="lm", se=F, show.legend = F, size=0.75,color="black") + 
  geom_point(aes(shape=Site_id, color=Treatment,fill=Treatment), size=3) +
  stat_regline_equation(
    label.y.npc = "top", label.x.npc = "left",
    aes(label = paste(..eq.label.., ..adj.rr.label.., sep = "~~~~")), 
    show.legend = F, size=4) +
  scale_x_continuous(limits=c(0,1.15))+
  scale_color_manual(values = treatment_colors) +
  scale_fill_manual(values = treatment_colors) +
  scale_shape_manual(values = site_symbols) +
  labs( x=expression("1/CO"[2]), y=expression(delta^13*"C-CO"[2]*" (‰)"))+
  theme(legend.position = "none")


# Combine plots
combined_keeling= ggarrange(plot_14C, 
          plot_d13C, #
          ncol = 1, nrow=2, labels="AUTO", heights = c(0.5, 0.5)
          )

combined_keeling

Keeling plot of CO2 isotope ratio, stable and radiogenic, coloured by treatment
👈 see code here
ggsave("Output/Figures/Figure6_keeling.pdf", plot =combined_keeling,
       height= 8, width = 4.5)

2.5.0.1 Linear regression and ANCOVA test

👈 see code here
extract_keeling_lm <- function(response_var, filter_var) {
  model <- lm(reformulate("CO2_mgL_filled_keeling", response = response_var),
              data = DC_Q %>% filter(!is.na(.data[[filter_var]])))
  s <- summary(model)
  coefs <- coef(model)
  f <- s$fstatistic
  p_val <- if (!is.null(f)) pf(f[1], f[2], f[3], lower.tail = FALSE) else NA

  tibble(
    Response  = response_var,
    Intercept = round(coefs[1], 3),
    Slope     = round(coefs[2], 3),
    R2_adj    = round(s$adj.r.squared, 3),
    P_value   = signif(p_val, 3),
    n         = nrow(DC_Q %>% filter(!is.na(.data[[filter_var]])))
  )
}

keeling_lm_results <- bind_rows(
  extract_keeling_lm("CO2_14C_Modern", "CO2_14C_Modern"),
  extract_keeling_lm("d13C_CO2",       "d13C_CO2")
)

knitr::kable(keeling_lm_results,
             caption = "Keeling plot linear regression results: 14C-CO2 and d13C-CO2 vs 1/CO2")
Keeling plot linear regression results: 14C-CO2 and d13C-CO2 vs 1/CO2
Response Intercept Slope R2_adj P_value n
CO2_14C_Modern 101.286 4.637 0.071 0.048400 42
d13C_CO2 -24.271 4.346 0.440 0.000001 42
👈 see code here
#Run ANCOVA test - Difference in hydro. response between Sites

knitr::kable(DC_Q %>%  #filter (Site_pairs=="FC_DC") %>% 
               anova_test(CO2_14C_Modern ~ CO2_mgL_filled_keeling*Treatment),
             caption="ANCOVA test results, 14C-CO2 Keeling | Treatment - FC_DC ") 
ANCOVA test results, 14C-CO2 Keeling | Treatment - FC_DC
Effect DFn DFd F p p<.05 ges
CO2_mgL_filled_keeling 1 34 7.810 0.008 * 0.187
Treatment 3 34 1.989 0.134 0.149
CO2_mgL_filled_keeling:Treatment 3 34 1.366 0.270 0.108
👈 see code here
#Run ANCOVA test - Difference in hydro. response between Sites
knitr::kable(DC_Q %>% anova_test(d13C_CO2 ~ CO2_mgL_filled_keeling*Treatment),
             caption="ANCOVA test results, 13C-CO2 Keeling | Treatment") 
ANCOVA test results, 13C-CO2 Keeling | Treatment
Effect DFn DFd F p p<.05 ges
CO2_mgL_filled_keeling 1 34 15.431 0.000398 * 0.312
Treatment 3 34 0.584 0.630000 0.049
CO2_mgL_filled_keeling:Treatment 3 34 1.343 0.277000 0.106

3 Supplementary Files

3.1 Exceedance Probability

👈 see code here
#Exceedance probability plot ::::::::::::::::::::::::::::::::::::::::::::::
#Database
Wide_q_FCDC=DC_wide <- DC_Q %>%
  filter(Site_id %in% "FC_DC2")%>%
  distinct(Date, Site_id, q_int_mmd, Treatment) %>%  # Remove any duplicate rows
  pivot_wider(
    id_cols = c(Date,Treatment),
    names_from = "Site_id",
    values_from = "q_int_mmd",
    names_prefix = "q_"
  )


Wide_q_FC=DC_wide <- DC_Q %>%
  filter(Site_id %in% "FC_1")%>%
  distinct(Date, Site_id, q_int_mmd, Treatment) %>%  # Remove any duplicate rows
  pivot_wider(
    id_cols = c(Date,Treatment),
    names_from = "Site_id",
    values_from = "q_int_mmd",
    names_prefix = "q_"
  )


# Calculations
Q_FCDC2_rank = Wide_q_FCDC%>%
  group_by(Treatment)%>%
  mutate(rank = rank(-q_FC_DC2)) %>%
  mutate(P = 100 * (rank / (length(q_FC_DC2) + 1))) %>%
  ungroup()


Q_FC1_rank = Wide_q_FC%>%
  group_by(Treatment)%>%
  mutate(rank = rank(-q_FC_1)) %>%
  mutate(P = 100 * (rank / (length(q_FC_1) + 1))) %>%
  ungroup()

# Identify dates when 14C-DOC samples were collected
DOC_14C_samples_FCDC <- DC_Q %>%
  filter(Site_id == "FC_DC2", !is.na(DOC_14C_Modern)) %>%
  select(Date, q_int_mmd, Treatment, DOC_14C_Modern) %>%
  distinct()

DOC_14C_samples_FC <- DC_Q %>%
  filter(Site_id == "FC_1", !is.na(DOC_14C_Modern)) %>%
  select(Date, q_int_mmd, Treatment, DOC_14C_Modern) %>%
  distinct()


# Join with the ranked data
samples_with_exceedance_FCDC <- DOC_14C_samples_FCDC %>%
  left_join(Q_FCDC2_rank %>% select(Date, P), by = "Date")

# Join with the ranked data
samples_with_exceedance_FC <- DOC_14C_samples_FC %>%
  left_join(Q_FC1_rank %>% select(Date, P), by = "Date")

#View(samples_with_exceedance)


#__________________________________________________________________________
#Visualisation
q_exceedance_FCDC2=ggplot(data = Q_FCDC2_rank) +
  geom_line(aes(y = P, x = q_FC_DC2, color = Treatment), size = 0.75) +
  # Add points for 14C-DOC sampling dates
  geom_point(data = samples_with_exceedance_FCDC,
             aes(y = P, x = q_int_mmd , color = Treatment, fill=Treatment),
             size = 3, shape = 24) +
  #scale_x_log10() +
  scale_y_continuous(breaks = seq(0, 100, 25)) +
  scale_x_continuous(limits=c(0,60))+
  scale_color_manual(values = treatment_colors) +
  scale_fill_manual(values = alpha(treatment_colors),0.7) +
  labs(y = "(%) exceed. probability",
       x = "q specific (mm/d)") +
  theme(legend.position = "none")



q_exceedance_FC1=ggplot(data = Q_FC1_rank) +
  geom_line(aes(y = P, x = q_FC_1, color = Treatment), size = 0.75) +
  geom_point(data = samples_with_exceedance_FC,  # Add points for 14C-DOC sampling dates
             aes(y = P, x = q_int_mmd , color = Treatment, fill=Treatment),
             size = 3, shape = 1) +
  #scale_x_log10() +
  scale_y_continuous(breaks = seq(0, 100, 25)) +
  scale_x_continuous(limits=c(0,60))+
  scale_color_manual(values = treatment_colors) +
  #scale_fill_manual(values = treatment_colors) +
  labs(y = "(%) exceed. probability",
       x = "q specific (mm/d)") +
  theme(legend.position = "none")

exceedanceprob_plot= ggarrange(q_exceedance_FC1, q_exceedance_FCDC2,
          nrow=1, labels = "AUTO")

exceedanceprob_plot

exceedance probability plot
👈 see code here
samples_with_exceedance_FC
# A tibble: 10 × 5
   Date       q_int_mmd Treatment      DOC_14C_Modern     P
   <date>         <dbl> <fct>                   <dbl> <dbl>
 1 2020-04-27     0.774 PreDisturbance           106. 55.3 
 2 2020-10-20     0.991 PostHarvest              104. 58.3 
 3 2021-04-30     6.89  PostHarvest              108. 11.2 
 4 2021-08-20     4.93  PostHarvest              107. 16.6 
 5 2021-09-24    24.7   2yrPostHarvest           109.  1.89
 6 2021-09-27     3.34  2yrPostHarvest           104. 16.2 
 7 2021-10-25     5.15  2yrPostHarvest           109. 10.9 
 8 2022-05-03     3.50  2yrPostHarvest           106. 15.2 
 9 2022-08-23     1.34  2yrPostHarvest           108. 33.3 
10 2022-10-24    NA     2yrPostHarvest           107. 85.5 
👈 see code here
samples_with_exceedance_FCDC
# A tibble: 12 × 5
   Date       q_int_mmd Treatment      DOC_14C_Modern     P
   <date>         <dbl> <fct>                   <dbl> <dbl>
 1 2020-03-12     1.07  PreDisturbance           98.0 33.0 
 2 2020-04-27     8.18  PreDisturbance          106.   6.60
 3 2020-08-27     0.340 PostHarvest             105.  94.6 
 4 2020-10-20     2.17  PostHarvest             105.  44.3 
 5 2021-04-30     7.87  PostHarvest             108.   5.15
 6 2021-08-20     4.67  PostHarvest             107.  18.5 
 7 2021-09-24    13.8   PostDrainage            108.   1.26
 8 2021-09-28     3.53  PostDrainage            106.  16.4 
 9 2021-10-25     6.25  PostDrainage            107.   6.74
10 2022-05-03     5.21  PostDrainage            106.   9.05
11 2022-08-23     0.459 PostDrainage            105.  67.6 
12 2022-10-25    NA     PostDrainage            105.  85.7 
👈 see code here
ggsave("Output/Figures/SupFigure_exceedprob.pdf", plot =exceedanceprob_plot, height = 4, width = 8)

3.2 Hydrograph

👈 see code here
# Define operation periods for treatments::::::::::::::::::::::::::::::::::::::::::
predisturbance_start =  as.Date("2020-01-01") 
predisturbance_end = as.Date("2020-08-24")

clearcut_start = as.Date("2020-07-01")
clearcut_end <- as.Date("2020-08-25")

postharvest_start = as.Date("2020-08-25")
postharvest_end= as.Date("2021-09-22")

ditch_cleaning_start <- as.Date("2021-09-01")
ditch_cleaning_end <- as.Date("2021-09-30")

postditch_start = as.Date("2021-09-23")
postditch_end= as.Date("2022-11-01") 



  

# Make the precipitation graph :::::::::::::::::::::::::::::::::::::::::::::::::::::


precipitation= ggplot(DC_Q %>%
         filter(Site_id %in% c("FC_DC1")),
       aes(y = P, x = as.Date(Date)), color=Site_id) +
  
  # Add gray background bars for operations
  annotate("rect", xmin = predisturbance_start, xmax = predisturbance_end,
           ymin = -Inf, ymax = Inf,
           fill = "#3CB7CC", alpha = 0.3) +
  
  
    
  annotate("rect", xmin = postharvest_start, xmax = postharvest_end,
           ymin = -Inf, ymax = Inf,
           fill = "#32A251", alpha = 0.3) +  
  
  
    
  annotate("rect", xmin = postditch_start, xmax = postditch_end,
           ymin = -Inf, ymax = Inf,
           fill = "#FF7F0F", alpha = 0.3) +    
    
  annotate("rect", 
           xmin = clearcut_start, xmax = clearcut_end,
           ymin = -Inf, ymax = Inf,
           fill = "#32A251",, alpha = 0.5) +
    
  annotate("rect", 
           xmin = ditch_cleaning_start, xmax = ditch_cleaning_end,
           ymin = -Inf, ymax = Inf,
           fill = "#FF7F0F", alpha = 0.5) +
  
  
  geom_bar(stat = 'identity', width=1) +
  labs( y= "Precipitation (mm/day)") +
  scale_y_reverse()+
  scale_color_manual(("#7EA6E0"))+ #"
  scale_x_date(limits=c(as.Date("2020-01-01"), as.Date("2022-11-01")),
               date_labels = "%b-%Y", date_breaks = "6 months") +
  
  
  labs(y = "precipitation (mm/d)",  x = "Date") +
  theme(legend.position = "none", axis.title.x = element_blank())



# Make Hydrograph :::::::::::::::::::::::::::::::::::::::::::::::::::::

hydrograph= ggplot(DC_Q %>%
         filter(Site_id %in% c("FC_1", "FC_DC2")),
       aes(y = q_int_mmd, x = as.Date(Date), color = Site_id)) +
  
 # Add recy background for operations
  annotate("rect", xmin = predisturbance_start, xmax = predisturbance_end,
           ymin = -Inf, ymax = Inf,
           fill = "#3CB7CC", alpha = 0.3) +
  
  
    
  annotate("rect", xmin = postharvest_start, xmax = postharvest_end,
           ymin = -Inf, ymax = Inf,
           fill = "#32A251", alpha = 0.3) +  
  
  
    
  annotate("rect", xmin = postditch_start, xmax = postditch_end,
           ymin = -Inf, ymax = Inf,
           fill = "#FF7F0F", alpha = 0.3) +    
    
  annotate("rect", 
           xmin = clearcut_start, xmax = clearcut_end,
           ymin = -Inf, ymax = Inf,
           fill = "#32A251",, alpha = 0.5) +
    
  annotate("rect", 
           xmin = ditch_cleaning_start, xmax = ditch_cleaning_end,
           ymin = -Inf, ymax = Inf,
           fill = "#FF7F0F", alpha = 0.5) +
  
  # Add the discharge lines
  geom_line() +
  scale_color_manual(values=site_colors)+ #"
   
  # Add text labels for operations
 annotate("text", x = clearcut_start + (clearcut_end - clearcut_start)/2, y = Inf, 
           label = "Forest clear cut operations",
           vjust = 1.2, hjust = 0.5, size = 3.5, color = "black") +
  
  annotate("text", x = ditch_cleaning_start + (ditch_cleaning_end -    ditch_cleaning_start)/2, y = Inf, 
           label = "Ditch cleaning operations",
           vjust = 1.2, hjust = 0.5, size = 3.5, color = "black") +
  
  scale_x_date(limits=c(as.Date("2020-01-01"), as.Date("2022-11-01")),
                 date_labels = "%b-%Y", date_breaks = "6 months") +
  labs(y = "specific discharge (mm/d)",   x = "Date",  color = "Stream") +
  theme(legend.position = "none", axis.title.x = element_blank())



hydrogram=ggarrange(precipitation, hydrograph,
          ncol=1, align="v", labels="AUTO")

hydrogram

Precipitation and discharge timeseries
👈 see code here
ggsave("Output/Figures/SupFigure_hydrogram.pdf", plot =hydrogram, height = 7, width = 8)

3.3 Correlation matrix

👈 see code here
# Correlation matrix for DOC concentration across sites over time
DC_wide_DOC <- DC_Q %>%
  select(Date, Site_id, DOC_mgL) %>%
  filter(!is.na(DOC_mgL)) %>%  # Remove NA values first
  group_by(Date, Site_id) %>%
  summarise(DOC_mgL = mean(DOC_mgL, na.rm = TRUE), .groups = 'drop') %>%  # Take mean if duplicates
  pivot_wider(names_from = Site_id, 
              values_from = DOC_mgL,
              names_prefix = "")

cor_matrix_DOC <- cor(DC_wide_DOC[, -1], 
                      method = "spearman", 
                      use = "pairwise.complete.obs")


# Correlation matrix for CO2 concentration across sites over time
DC_wide_CO2 <- DC_Q %>%
  select(Date, Site_id, CO2_mgL) %>%
  filter(!is.na(CO2_mgL)) %>%  # Remove NA values first
  group_by(Date, Site_id) %>%
  summarise(CO2_mgL = mean(CO2_mgL, na.rm = TRUE), .groups = 'drop') %>%  # Take mean if duplicates
  pivot_wider(names_from = Site_id, 
              values_from = CO2_mgL,
              names_prefix = "")

cor_matrix_CO2 <- cor(DC_wide_CO2[, -1], 
                      method = "spearman", 
                      use = "pairwise.complete.obs")


# Correlation matrix for 14CCO2 concentration across sites over time
DC_wide_CO2_14C <- DC_Q %>%
  select(Date, Site_id, CO2_14C_Modern) %>%
  filter(!is.na(CO2_14C_Modern)) %>%  # Remove NA values first
  group_by(Date, Site_id) %>%
  summarise(CO2_14C = mean(CO2_14C_Modern, na.rm = TRUE), .groups = 'drop') %>%  # Take mean if duplicates
  pivot_wider(names_from = Site_id, 
              values_from = CO2_14C,
              names_prefix = "")


cor_matrix_CO2_14C <- cor(DC_wide_CO2_14C[, -1], 
                      method = "spearman", 
                      use = "pairwise.complete.obs")



# Correlation matrix for 14C-DOC concentration across sites over time
DC_wide_DOC_14C <- DC_Q %>%
  select(Date, Site_id, DOC_14C_Modern) %>%
  filter(!is.na(DOC_14C_Modern)) %>%  # Remove NA values first
  group_by(Date, Site_id) %>%
  summarise(DOC_14C = mean(DOC_14C_Modern, na.rm = TRUE), .groups = 'drop') %>%  # Take mean if duplicates
  pivot_wider(names_from = Site_id, 
              values_from = DOC_14C,
              names_prefix = "")


cor_matrix_DOC_14C <- cor(DC_wide_DOC_14C[, -1], 
                      method = "spearman", 
                      use = "pairwise.complete.obs")


#___________________________________________________________________________________

corplot_DOC=ggcorrplot(cor_matrix_DOC, method="circle", type="upper", lab=T,insig = "blank",outline.col = "white", title = "[DOC]")
corplot_14DOC=ggcorrplot(cor_matrix_DOC_14C, method="circle", type="upper", lab=T,insig = "blank",outline.col = "white", title = "14C-DOC")
corplot_CO2=ggcorrplot(cor_matrix_CO2, method="circle", type="upper", lab=T,insig = "blank",outline.col = "white", title = "[CO2]")
corplot_14CO2=ggcorrplot(cor_matrix_CO2_14C, method="circle", type="upper", lab=T,insig = "blank",outline.col = "white",title = "14C-CO2")


combined_cormatrix= ggarrange(corplot_DOC,corplot_14DOC,
          corplot_CO2, corplot_14CO2,
          labels = "AUTO", nrow=2, ncol=2)

combined_cormatrix

Correlation matrix Stream water chemistry timeseries
👈 see code here
ggsave("Output/Figures/SupFigure_corrmatrix.pdf", plot =combined_cormatrix, height = 6, width = 6)

3.4 C-q relationship model

👈 see code here
# Hydrological control over  C concentration by Site

grid_cq_scatters=  ggplot(DC_Q %>% pivot_longer(
                     cols = c(DOC_mgL, CO2_mgL),
                     names_to = "Carbon_species",
                     values_to = "C_mgL"
                   ),
       aes(y=C_mgL, x=q_int_mmd, color=Treatment, fill=Treatment, shape=Site_id))+ 
  geom_point( size=2, alpha=0.7, show.legend = F)+
 
  geom_smooth(method="lm", se=F, show.legend = F)+
  #stat_regline_equation(label.y.npc = "top", label.x.npc = "left",
  #aes(label =  paste(..eq.label.., ..adj.rr.label.., 
  #                   sep = "~~~~"), color = Treatment), 
  #                    show.legend = F, size=3)+
  facet_grid(Carbon_species~Site_id, scale="free_y")+  
    
  scale_shape_manual(values=c(site_symbols))+
  scale_x_log10(limits = c(0.02, 40))+
  scale_y_log10()+
  scale_color_manual(values=treatment_colors)+
  scale_fill_manual(values=treatment_colors)+
  
  labs(x="q (mm/d)", y=bquote("C (mg/L)"))+
  theme(legend.position = "top", base_size=8)

grid_cq_scatters

relationship between C concetration and discharge coloured by site and treatment
👈 see code here
ggsave("Output/Figures/SupFigure_c_q_scatters.pdf", plot =grid_cq_scatters, height = 6, width = 12)

3.4.0.1 Linear regressions

👈 see code here
lm_C_q_results <- DC_Q %>%
  pivot_longer(cols = c(DOC_mgL, CO2_mgL),
               names_to = "Carbon_species",
               values_to = "C_mgL") %>%
  filter(!is.na(C_mgL), !is.na(q_int_mmd), C_mgL > 0, q_int_mmd > 0) %>%
  group_by(Carbon_species, Site_id, Treatment) %>%
  group_modify(~ {
    data <- .x
    
    if (nrow(data) < 3) {
      return(tibble(Intercept = NA, Slope = NA, R2_adj = NA, P_value = NA, n = nrow(data)))
    }
    
    model <- lm(log10(C_mgL) ~ log10(q_int_mmd), data = data)
    s <- summary(model)
    coefs <- coef(model)
    f <- s$fstatistic
    p_val <- if (!is.null(f)) pf(f[1], f[2], f[3], lower.tail = FALSE) else NA
    
    tibble(
      Intercept = round(coefs[1], 3),
      Slope     = round(coefs[2], 3),
      R2_adj    = round(s$adj.r.squared, 3),
      P_value   = signif(p_val, 3),
      n         = nrow(data)
    )
  }) %>%
  ungroup() %>%
  arrange(Carbon_species, Site_id, Treatment)

knitr::kable(lm_C_q_results,
             caption = "Linear regression results (log10-log10): C concentration ~ discharge by species, site and treatment")
Linear regression results (log10-log10): C concentration ~ discharge by species, site and treatment
Carbon_species Site_id Treatment Intercept Slope R2_adj P_value n
CO2_mgL FC_1 PreDisturbance 0.340 0.019 0.010 0.309000 14
CO2_mgL FC_1 PostHarvest 0.393 0.020 -0.010 0.411000 31
CO2_mgL FC_1 2yrPostHarvest 0.331 0.068 0.215 0.017300 22
CO2_mgL FC_2 PreDisturbance 0.630 0.063 0.256 0.018800 18
CO2_mgL FC_2 PostHarvest 0.693 -0.165 0.133 0.019400 34
CO2_mgL FC_2 2yrPostHarvest 0.755 -0.500 0.861 0.000003 13
CO2_mgL FC_DC1 PreDisturbance 0.192 -0.010 -0.057 0.769000 18
CO2_mgL FC_DC1 PostHarvest 0.321 -0.091 0.103 0.036100 34
CO2_mgL FC_DC1 PostDrainage 0.181 0.053 -0.005 0.357000 24
CO2_mgL FC_DC2 PreDisturbance 0.092 0.046 0.215 0.026100 19
CO2_mgL FC_DC2 PostHarvest 0.270 -0.028 -0.018 0.536000 35
CO2_mgL FC_DC2 PostDrainage 0.145 0.018 -0.036 0.772000 27
DOC_mgL FC_1 PreDisturbance 1.492 0.023 0.081 0.168000 14
DOC_mgL FC_1 PostHarvest 1.619 0.142 0.370 0.000105 33
DOC_mgL FC_1 2yrPostHarvest 1.607 0.046 0.054 0.153000 22
DOC_mgL FC_2 PreDisturbance 1.527 0.021 0.027 0.243000 18
DOC_mgL FC_2 PostHarvest 1.792 -0.072 0.001 0.319000 34
DOC_mgL FC_2 2yrPostHarvest 1.901 -0.109 0.076 0.187000 13
DOC_mgL FC_DC1 PreDisturbance 1.250 0.055 0.085 0.128000 18
DOC_mgL FC_DC1 PostHarvest 1.394 0.097 0.034 0.149000 35
DOC_mgL FC_DC1 PostDrainage 1.327 -0.013 -0.041 0.773000 24
DOC_mgL FC_DC2 PreDisturbance 1.196 0.015 -0.036 0.545000 19
DOC_mgL FC_DC2 PostHarvest 1.475 0.011 -0.029 0.868000 35
DOC_mgL FC_DC2 PostDrainage 1.322 0.070 0.034 0.177000 27

3.4.0.2 ANCOVA test - DOC-q

Is there a significant difference in the hydrological response of DOC concentrations between Treatments or Sites?

👈 see code here
#Run ANCOVA test - Difference in hydro. response between treatments

knitr::kable(DC_Q%>%  
             anova_test(DOC_mgL ~ q_int_mmd*Treatment), 
             caption = "ANCOVA (ALL SITES) - DOC * q / treatment")
ANCOVA (ALL SITES) - DOC * q / treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 284 3.363 0.068 0.012
Treatment 3 284 20.172 0.000 * 0.176
q_int_mmd:Treatment 3 284 0.501 0.682 0.005
👈 see code here
knitr::kable(filter(DC_Q, Site_id %in% c("FC_1"))%>%  
             anova_test(DOC_mgL ~ q_int_mmd*Treatment), 
             caption = "ANCOVA (FC_1) - DOC * q / treatment")
ANCOVA (FC_1) - DOC * q / treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 63 26.760 2.60e-06 * 0.298
Treatment 2 63 8.600 4.99e-04 * 0.214
q_int_mmd:Treatment 2 63 4.915 1.00e-02 * 0.135
👈 see code here
knitr::kable(filter(DC_Q, Site_id %in% c("FC_2"))%>%   
             anova_test(DOC_mgL ~ q_int_mmd*Treatment), 
             caption = "ANCOVA (FC_2) - DOC * q / treatment")
ANCOVA (FC_2) - DOC * q / treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 59 0.482 0.490 0.008
Treatment 2 59 5.555 0.006 * 0.158
q_int_mmd:Treatment 2 59 0.278 0.758 0.009
👈 see code here
knitr::kable(filter(DC_Q, Site_id %in% c("FC_DC1"))%>%  
             anova_test(DOC_mgL ~ q_int_mmd*Treatment), 
             caption = "ANCOVA (FC_DC1) - DOC * q / treatment")
ANCOVA (FC_DC1) - DOC * q / treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 71 13.818 0.000399 * 0.163
Treatment 2 71 6.575 0.002000 * 0.156
q_int_mmd:Treatment 2 71 1.496 0.231000 0.040
👈 see code here
knitr::kable(filter(DC_Q, Site_id %in% c("FC_DC2"))%>%   
             anova_test(DOC_mgL ~ q_int_mmd*Treatment), 
             caption = "ANCOVA (FC_DC2) - DOC * q / treatment")
ANCOVA (FC_DC2) - DOC * q / treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 75 4.213 4.40e-02 * 0.053
Treatment 2 75 13.721 8.40e-06 * 0.268
q_int_mmd:Treatment 2 75 0.126 8.82e-01 0.003

3.4.0.3 ANCOVA test - CO2-q

👈 see code here
#Run ANCOVA test - Difference in hydro. response between treatments
knitr::kable(DC_Q  %>%  anova_test(CO2_mgL ~ q_int_mmd*Treatment), 
             caption = "ANCOVA test results - CO2 * q / treatment")
ANCOVA test results - CO2 * q / treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 281 0.084 0.772000 0.000298
Treatment 3 281 6.027 0.000544 * 0.060000
q_int_mmd:Treatment 3 281 0.641 0.589000 0.007000
👈 see code here
knitr::kable(filter(DC_Q, Site_id %in% c("FC_1"))%>%   
             anova_test(CO2_mgL ~ q_int_mmd*Treatment), 
             caption = "ANCOVA (FC_1) - CO2 * q / treatment")
ANCOVA (FC_1) - CO2 * q / treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 61 9.209 0.004 * 0.131
Treatment 2 61 3.092 0.053 0.092
q_int_mmd:Treatment 2 61 3.826 0.027 * 0.111
👈 see code here
knitr::kable(filter(DC_Q, Site_id %in% c("FC_2"))%>%  
             anova_test(CO2_mgL ~ q_int_mmd*Treatment), 
             caption = "ANCOVA (FC_2) - CO2 * q / treatment")
ANCOVA (FC_2) - CO2 * q / treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 59 0.977 0.327 0.016
Treatment 2 59 0.639 0.532 0.021
q_int_mmd:Treatment 2 59 3.595 0.034 * 0.109
👈 see code here
knitr::kable(filter(DC_Q, Site_id %in% c("FC_DC1"))%>%  
             anova_test(CO2_mgL ~ q_int_mmd*Treatment), 
             caption = "ANCOVA (FC_DC1) - CO2 * q / treatment")
ANCOVA (FC_DC1) - CO2 * q / treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 70 0.187 0.667 0.003
Treatment 2 70 3.106 0.051 0.081
q_int_mmd:Treatment 2 70 1.970 0.147 0.053
👈 see code here
knitr::kable(filter(DC_Q, Site_id %in% c("FC_DC2"))%>%   
             anova_test(CO2_mgL ~ q_int_mmd*Treatment), 
             caption = "ANCOVA (FC_DC2) - CO2 * q / treatment")
ANCOVA (FC_DC2) - CO2 * q / treatment
Effect DFn DFd F p p<.05 ges
q_int_mmd 1 75 5.180 0.026 * 0.065
Treatment 2 75 7.481 0.001 * 0.166
q_int_mmd:Treatment 2 75 2.279 0.109 0.057
👈 see code here
# Hydrological control over C concentration overall model
#ggplot(DC_Q %>% pivot_longer(
#                     cols = c(DOC_mgL, CO2_mgL),
#                     names_to = "Carbon_species",
#                     values_to = "C_mgL"
#                   ),
#       aes(y=C_mgL, x=q_int_mmd*1000,  fill=Treatment, color=Treatment))+ 
#  geom_point(aes(shape=Site_id), size=2, alpha=0.7, show.legend = F)+
 
#  geom_smooth(method="lm", se=F, aes(color=Treatment), show.legend = T)+
#  stat_regline_equation(label.y.npc = "top", label.x.npc = "left",
#  aes(label =  paste(..eq.label.., ..adj.rr.label.., 
#                     sep = "~~~~"), color = Treatment), 
#                      show.legend = F, size=3)+
#  facet_wrap(~Carbon_species, scale="free_y", nrow=2)+  
    
#  scale_shape_manual(values=c(site_symbols))+
#  scale_x_log10()+
#  scale_y_log10()+
#  scale_color_manual(values=treatment_colors)+
#  scale_fill_manual(values=treatment_colors)+
  
#  labs(x="q (mm/d)", y=bquote("C (mg/L)"))+
#  theme(legend.position = "top", base_size=8)

4 Summary tables

Overall 14C sampling period:
# A tibble: 1 × 4
  first_sampling last_sampling total_days total_samples
  <date>         <date>             <dbl>         <int>
1 2020-03-12     2022-10-25           957            46

14C samples by site:
# A tibble: 4 × 7
  Site_id n_total n_DOC_14C n_CO2_14C n_both first_date last_date 
  <fct>     <int>     <int>     <int>  <int> <date>     <date>    
1 FC_1         10        10         9      9 2020-04-27 2022-10-24
2 FC_2         12        12        11     11 2020-03-12 2022-10-25
3 FC_DC1       12        12        11     11 2020-03-12 2022-10-24
4 FC_DC2       12        12        11     11 2020-03-12 2022-10-25

Sampling intervals by site (days):
# A tibble: 4 × 5
  Site_id mean_interval_days median_interval_days min_interval_days
  <fct>                <dbl>                <dbl>             <dbl>
1 FC_1                 101.                   112                 3
2 FC_2                  87                     63                 3
3 FC_DC1                86.9                   62                 3
4 FC_DC2                87                     63                 4
# ℹ 1 more variable: max_interval_days <dbl>

First 10 sampling events with intervals:
# A tibble: 10 × 6
   Date       Site_id DOC_14C_Modern CO2_14C_Modern days_since_previous
   <date>     <fct>            <dbl>          <dbl>               <dbl>
 1 2020-03-12 FC_DC2            98.0          101.                   NA
 2 2020-03-12 FC_2             104.            99.3                   0
 3 2020-03-12 FC_DC1           103.           104.                    0
 4 2020-04-27 FC_1             106.            NA                    46
 5 2020-04-27 FC_DC2           106.            NA                     0
 6 2020-04-27 FC_2             106.            NA                     0
 7 2020-04-27 FC_DC1           107.            NA                     0
 8 2020-08-27 FC_DC2           105.           105.                  122
 9 2020-08-28 FC_2             105.           102.                    1
10 2020-08-28 FC_DC1           106.           103.                    0
# ℹ 1 more variable: sample_type <chr>

=== SUMMARY ===
Total 14C samples collected: 46
Sampling period: 2020-03-12 to 2022-10-25 (957 days)
Average sampling interval: 21.3 days
Number of sites sampled: 4

Total 14C samples by type at each site:
# A tibble: 4 × 3
  Site_id `14C-DOC samples` `14C-CO2 samples`
  <fct>               <int>             <int>
1 FC_1                   10                 9
2 FC_2                   12                11
3 FC_DC1                 12                11
4 FC_DC2                 12                11