R/run_model.R

#' Runs a given scenario
#' @param scenario_folder The path to the folder containing the scenario
#' @param scenario_file The name of the scenario file
#' @param model_exe_folder The path to the folder containing the model's executable file
#' @param model_exe_file The name of the model's exe file
#' @export

run_scenario <- function(scenario_folder, scenario_file,
                         model_exe_folder, model_exe_file){
  path_to_scenario <- file.path(scenario_folder, scenario_file)
  path_to_model_exe <- file.path(model_exe_folder, model_exe_file)
  command <- paste('"', path_to_model_exe, '" -sc "', path_to_scenario, '"', sep = "")
  command <- gsub("/", "\\\\", command)
  system(command, intern = TRUE)
  return(command)
}
philliplab/modgenTester documentation built on May 25, 2019, 5:06 a.m.