load_packages <- function(packages) {
# Check for uninstalled packages
uninstalled <- packages[!packages %in% installed.packages()[,"Package"]]
# Install uninstalled packages
if(length(uninstalled)) install.packages(uninstalled, dependencies = TRUE)
# Load all packages
for (pkg in packages) {
if (!require(pkg, character.only = TRUE, quietly = TRUE)) {
message(paste("Failed to load package:", pkg))
}
}
}
# List of packages to check, install, and load
packages <- c("mgcv", "MuMIn", "multcomp", "gratia",
"ggpubr", "patchwork", "broom", "knitr", "janitor",
"here","ggpubr","MetBrewer","GGally","tidyverse")
load_packages(packages)
i_am('README.md')
# Functions
## Standard error
std <- function(x) sd(x)/sqrt(length(x))
# Setting R options for jupyterlab
options(repr.plot.width = 10, repr.plot.height = 10,repr.matrix.max.rows=10)here() starts at /home/datascience/herbivore_nutrient_interactions



