prepare_directories: Checks if the necessary directories exist, and otherwise...

View source: R/config_handling.R

prepare_directoriesR Documentation

Checks if the necessary directories exist, and otherwise creates them

Description

Checks if the necessary directories exist, and otherwise creates them

Usage

prepare_directories(
  config_file = NA,
  input_directory = NA,
  output_directory = NA
)

Arguments

config_file

path to the config file, if NA the default config will be used

input_directory

path to input directory, if NA it will be derived from the config file path

output_directory

path to output directory, if NA it will be derived from the config file path

Details

This function will be called by the simulation, but is made available if the directories should be created manually beforehand, for example to redirect the stdout to a file in the output directory.

Value

returns a named list with the paths for the input and output directories

Examples

## Not run: 
  # this is an internal function used to attribute directories by deduction
  # called at the start of a simulation run
  datapath <- system.file(file.path("extdata", "WorldCenter"), package = "gen3sis")
  # deducing input directory and setting output directory
  prepare_directories(config_file = file.path(datapath, "config/config_worldcenter.R"))
  # setting output directory
  prepare_directories(config_file = file.path(datapath, "config/config_worldcenter.R"), 
                      input_directory = file.path(datapath, "landscape"))

## End(Not run)

gen3sis documentation built on Nov. 22, 2023, 5:07 p.m.