D Session Information

Reproducibility relies on the ability to precisely recreate the working environment, and session information serves as a vital reference to achieve this consistency. Here we record details about the R environment, package versions, and system settings of the computing environment at the time of analysis.

library(sessioninfo)

# Get session info
info <- capture.output(print(session_info()))

# Define patterns to exclude
exclude_patterns <- c("/Users/.*", "Africa/Dar_es_Salaam") # This line is location-dependent

# Exclude lines containing specific information
info_filtered <- info[!grepl(paste(exclude_patterns, collapse = "|"), info)]

# Save the filtered session info to a text file in the root directory without line numbers
cat(info_filtered, file = "session_info.txt", sep = "\n")