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)character name of the workflow component.
logical indicates to start with a clean (empty) directory.
Invisible NULL, called for side effects.
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.
# not run because it creates side effects
if (FALSE) {
proj_create_dir_target("01-clean")
}