A target directory is dedicated to each RMarkdown file in a workflow. Call this function from within an RMarkdown file to create its target directory. If the directory already exists and clean is TRUE, it will be deleted then re-created.

proj_create_dir_target(name, clean = TRUE)

Arguments

name

character name of the workflow component.

clean

logical indicates to start with a clean (empty) directory.

Value

Invisible NULL, called for side effects.

Details

Following this workflow philosophy, the target directory is the only directory to which a RMarkdown directory should write. The exception to this is the last RMarkdown file in a workflow sequence, which may publish data elsewhere.

To establish the connection between the two, the target directory shall be named for the RMarkdown file itself. This is the purpose of the name argument; its value should be the name of the current workflow component, i.e. the name of the current Rmd file.

To make things a little easier, the template used by proj_workflow_use_rmd() includes a call to proj_create_dir_target(), with the name argument populated.

Examples

# not run because it creates side effects
if (FALSE) {
  proj_create_dir_target("01-clean")
}