Skip to contents

Create subdirectories for an R project.

Usage

setup_project(
  root = getwd(),
  dirs = c("data/1-source", "data/2-final", "output", "scripts"),
  rmd = TRUE
)

Arguments

root

The project root directory (defaults to the current working directory).

dirs

The subdirectories to create, as a character vector. The defaults are described in the Details section.

rmd

Call use_rmd_template() if TRUE (with defaults only, currently).

Value

root (invisibly).

Details

By default, these subdirectories are created under root:

  • data/

    • 1-source/: Unmodified source data originating outside of the project.

    • 2-final/: Final data products in native R formats only.

  • output/: Outputs for consumption outside R (CSV, XLSX, XML, HTML, PDF, etc.).

  • scripts/: All script files.

Directories are created recursively by base::dir.create().

Examples

if (FALSE) { # \dontrun{
setup_project()
} # }