preRunSetupProject parses an R script (default: "global.R") and
evaluates its contents up to the setupProject() call, either fully or
partially based on the upTo argument. This is useful for initializing
only certain parts of a project without executing the entire setup.
preRunSetupProject(file = "global.R", upTo = TRUE, envir = parent.frame())Character string. Path to the R script containing the setup code.
Defaults to "global.R".
Character or logical. If TRUE, evaluates all code up to and
including the first setupProject() call within file.
If a character string, only evaluates the code up to the setupProject plus
the arguments up to the upTo named argument. Defaults to "paths" so
that paths will be evaluated and availble to use.
The environment where the function should be finding objects. Defaults
to parent.frame() so it can find them in the calling frame.
The evaluated result of the executed portion of setupProject().
i.e., a list returned by setupProject().
The function:
Parses the specified file using parse().
Identifies the line where setupProject() is called.
Evaluates all code before the setupProject() call.
Depending on upTo, evaluates either the full call or a subset
of its arguments.
This allows selective initialization of project components for debugging or partial setup in large projects.
if (FALSE) { # \dontrun{
# Run file up to and including the setupProject, but only to the 'paths' argument
result <- preRunSetupProject(file = "global.R", upTo = "paths")
# Run file up to and including full setupProject()
result <- preRunSetupProject(file = "global.R", upTo = TRUE)
} # }