# Prepare a temporary directory to write to
tmp = file.path(tempdir(), "test-setup_directory")
dir.create(tmp)
# We need `force = TRUE` here in order to make the example work in
# non-interactive settings.
setup_directory(root = tmp, include_examples = FALSE, force = TRUE)
# The `input`, `output` and `data` directories are now present.
list.files(tmp)
# Warnings are issued if directories are already present. Example files
# are still copied and potentially overwritten.
setup_directory(root = tmp, include_examples = TRUE, force = TRUE)
# Example files are now present
list.files(tmp, recursive = TRUE)
# End of the example. The following code is for cleaning up.
unlink(tmp, recursive = TRUE)
Run the code above in your browser using DataLab