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.

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.

Value

importWF will return an SYSargsList object.

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.

Author

Le Zhang and Daniela Cassol

Examples

file_path <- system.file("extdata/spr_simple_lw.Rmd", package="systemPipeR")
sal <- SPRproject(overwrite = TRUE)
#> Recreating directory '/home/runner/work/systemPipeR/systemPipeR/docs/reference/.SPRproject'
#> Creating file '/home/runner/work/systemPipeR/systemPipeR/docs/reference/.SPRproject/SYSargsList.yml'
sal <- importWF(sal, file_path)
#> Reading Rmd file
#> 
#> 
#>  ---- Actions ----
#> Checking chunk eval values
#> Checking chunk SPR option
#> Ignore non-SPR chunks: 17
#> Parse chunk code
#> Checking preprocess code for each step
#> No preprocessing code for SPR steps found
#> Now importing step 'firstStep' 
#> Now importing step 'secondStep' 
#> Now back up current Rmd file as template for `renderReport`
#> Template for renderReport is stored at 
#>  /home/runner/work/systemPipeR/systemPipeR/docs/reference/.SPRproject/workflow_template.Rmd 
#>  Edit this file manually is not recommended 
#> Now check if required tools are installed 
#> There is no commandline (SYSargs) step in this workflow, skip.
#> Import  done
#>