importWF: Import R Markdown file as workflow

View source: R/linewise_utilities.R

importWFR Documentation

Import R Markdown file as workflow

Description

Import R Markdown file as workflow. Each R code chunk will be set as a step in the workflow. This operation requires a few extra settings on the R Markdown chunk options, to include a particular code chunk in the workflow analysis. Please check Details.

Usage

importWF(
    sysargs, file_path, ignore_eval = TRUE,
    update = FALSE, confirm = FALSE,
    check_tool = !update,
    check_module = check_tool,
    verbose = TRUE
)

Arguments

sysargs

SYSargsList empty object. More information on Details.

file_path

string, file path of the workflow file.

ignore_eval

logical, treat all R chunks' eval option as TRUE in workflow Rmd file even if some chunks have eval=FALSE.

update

logical, If you have ever changed the template and want to sync new changes, turn TRUE to update the workflow. This function will find the difference between old template and this new template, update line number records, update preprocessing code, and try to import new steps. The updated template is useful in renderReport() function.

confirm

logical, Only useful when you combine update = TRUE, some questions will be asked during update. Changing this to TRUE would skip these questions and directly say "Yes" to all answers. Useful in non-interactive mode. Default is to say "No" in non-interactive mode.

check_tool

logical, whether to check all required tools by this workflow are in PATH (callable). It uses the listCmdTools function to perform the check. The default is the reverse of update. It means if it is the first importing the workflow, tools and modules will be checked. If it is updating the existing workflow, tools will not be checked.

check_module

logical, whether to check all required modules are available. To do so, a modular system has be to installed. If no modular system, this check will be skipped, even if check_module = TRUE. It uses the listCmdModules function to perform the check. Check the help of module to know more about modular system.

verbose

logical, print out verbose message while function running.

Details

To include a particular code chunk from the R Markdown file in the workflow analysis, please use the following code chunk options:

- spr = 'r': for code chunks with R code lines; - spr = 'sysargs': for code chunks with an 'SYSargsList' object; - spr.dep = <StepName>: for specify the previous dependency. If this options is not found, it will automaticly add the previous step.

For spr = 'sysargs', the last object assigned needs to be the SYSargsList. If the spr flag is not found, the R chunk will not be included in the workflow.

It is required to start a project using SPRproject() function, and use the object to populate the steps from R Markdown file.

Value

importWF will return an SYSargsList object.

Author(s)

Le Zhang and Daniela Cassol

See Also

SYSargsList renderReport

Examples

file_path <- system.file("extdata/spr_simple_lw.Rmd", package="systemPipeR")
sal <- SPRproject(overwrite = TRUE)
sal <- importWF(sal, file_path)

tgirke/systemPipeR documentation built on Sept. 24, 2024, 9:48 a.m.