Environmental Informatics Lab @ Marburg University


Helpers to set up and manage analysis environments and enable reproducible research.

Use case for setting up a project

To set up an RStudio project, folder structures for data analysis and initialize a Git and dvc repository, you can use the template "envimar". Other templates for initialization without dvc (envimar_no_dvc) and no Git/dvc (envimar_no_git_dvc) are also available. For other options, define the input manually or create another template using pckgDefaults.R.

# Install envimaR

root_folder <- tempdir()
initEnvimaR(root_folder = root_folder, standard_setup = "envimar")

Use 000_settings.R for mastering the project environment

Once a project environment is initialized, two scripts are created:

This is what the 000_setup.R script looks like:

#' ...

# Define libraries (by adding libraries to the libs vector)
libs <- c()

# Load libraries and create environment object to be used in other scripts for path navigation
project_folders <- list.dirs(path = root_folder, full.names = FALSE, recursive = TRUE)
project_folders <- project_folders[!grepl("\\..", project_folders)]
envrmt <- createEnvi(
  root_folder = root_folder, fcts_folder = file.path(root_folder, "src/functions/"),  folders = project_folders,
  libs = libs, create_folders = FALSE)
meta <- createMeta(root_folder)

# Define more variables

# Load more data

envima/envimaR documentation built on July 18, 2021, 1:40 p.m.