Skip to content

Commit

Permalink
User can pass rm=TRUE to sourceTAF()
Browse files Browse the repository at this point in the history
  • Loading branch information
Arni Magnusson committed Mar 19, 2018
1 parent 9ef30fa commit 46b793b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
14 changes: 6 additions & 8 deletions R/makeTAF.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#' older than the directory of the previous TAF step.
#'
#' @param script TAF script filename.
#' @param rm whether to remove all objects from the global environment before
#' each script is run.
#' @param \dots passed to \code{\link{make}} and \code{\link{sourceTAF}}.
#'
#' @return \code{TRUE} or \code{FALSE}, indicating whether the script was run.
Expand Down Expand Up @@ -34,27 +32,27 @@
#'
#' @export

makeTAF <- function(script, rm=FALSE, ...)
makeTAF <- function(script, ...)
{
owd <- setwd(dirname(script))
on.exit(setwd(owd))
script <- basename(script)
out <- switch(script,
"data.R"=make("data.R",
dir(pattern="^data_.*\\.R$"),
"data", engine=sourceTAF, rm=rm, ...),
"data", engine=sourceTAF, ...),
"input.R"=make("input.R",
c("data",dir(pattern="^input_.*\\.R$")),
"input", engine=sourceTAF, rm=rm, ...),
"input", engine=sourceTAF, ...),
"model.R"=make("model.R",
c("input",dir(pattern="^model_.*\\.R$")),
"model", engine=sourceTAF, rm=rm, ...),
"model", engine=sourceTAF, ...),
"output.R"=make("output.R",
c("model",dir(pattern="^output_.*\\.R$")),
"output", engine=sourceTAF, rm=rm, ...),
"output", engine=sourceTAF, ...),
"report.R"=make("report.R",
c("output",dir(pattern="^report_.*\\.R$")),
"report", engine=sourceTAF, rm=rm, ...),
"report", engine=sourceTAF, ...),
FALSE)
invisible(out)
}
5 changes: 1 addition & 4 deletions man/makeTAF.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 46b793b

Please sign in to comment.