-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartOutside.R
35 lines (31 loc) · 911 Bytes
/
startOutside.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#' Script to call the starting function of brick
#'
#' Load BRICK and start the model by calling startModel
#'
#' This function loads the package brick, reads in the arguments
#' passed via the command line and calls the startModel function.
#'
#' @author Ricarda Rosemann
#'
library(devtools)
load_all("../brick")
# Only if this file is run directly via Rscript startOutside.R, but not if this file
# is sourced, actually run
if (sys.nframe() == 0L) {
# We assume here that our working directory is an output directory
config <- NULL
path <- NULL
outputFolder <- "output"
args <- commandArgs()
for (k in seq_along(args)) {
if (args[k] == "-c") {
config <- args[k + 1]
} else if (args[k] == "-p") {
path <- args[k + 1]
} else if (args[k] == "-o") {
outputFolder <- args[k + 1]
}
}
startModel(config = config, path = path,
outputFolder = outputFolder)
}