# Reading in cleaned data
<- readRDS(here("outputs", "conc_final.RDS")) conc_final
Nutrient Concentrations
Background
This goal of this project was to reproduce Figure 3 from “Effects of hurricane disturbance on stream water concentrations and fluxes in eight tropical forest watersheds of the Luquillo Experimental Forest, Puerto Rico. Journal of Tropical Ecology” by Schaefer et al 2000. This study analyzes the nutrient concentrations from streams of Bisley, Puerto Rico during 1986-1994, and analyzes the impacts of Hurricane Hugo on the concentrations.
Data
The data used was taken from four sites in Bisley, Puerto Rico and measured the concentrations of Calcium, Potassium, Magnesium, Ammonium-N, and Nitrate-N throughout time. Raw data was combined to create one data set with all target sites.
Methods
Data was filtered and selected to only include information necessary to run the analysis and apply a 9-week rolling average to the concentrations. The main steps after data wrangling and cleaning were to arrange samples by date, group them by site and nutrient type to run averages within individual sites and nutrients. The slide_index_dbl function was used to calculate the rolling mean over a 9-week period.
# Calling in my function
source(here("R", "rolling-mean-function.R"))
# Applying function to data
<- rolling_mean(conc_final) conc_mean
Results
The produced figure shows increases in concentrations of nutrients with available data across all sites following Hurricane Hugo in 1989. While most nutrient concentrations remained high in the years following the hurricane, Nitrate-N started to show a decrease after 1990.
#Creating hurricane date variable for vline
<- as.Date("1989-09-18")
hurricane
<- ggplot(conc_mean,
conc_mean_fig aes(sample_date, roll_mean)) +
geom_line(aes(color = sample_id)) +
geom_vline(xintercept = hurricane,
linetype = "dotted") + #adding huricane to graph
scale_color_paletteer_d("nationalparkcolors::Arches") +
#wrapping by nutrients
facet_wrap(~nutrient,
ncol = 1,
scales = "free_y", # allow nutrients to be scaled seperately
strip.position = "left",
labeller = as_labeller( # updating labels
c(ca = "Ca (mg l^-1)",
k = "K (mg l^-1)",
mg = "Mg (mg l^-1)",
no3_n = "NO3-N (ug l^-1)",
nh4_n = "NH4-N (ug l^-1)"))) +
# axis ang legend labels
labs(x = "Years",
y = "",
color = "Site") +
theme_minimal() +
# adjusting text placement and size
theme(strip.background = element_blank(),
strip.placement = "outside",
strip.text.y = element_text(size = 7.5),
axis.text.y = element_text(size = 6))
conc_mean_fig
ggsave(here("figs", "conc_mean_fig.png"), height = 5, width = 7)