Skip to contents

projr_init creates a standard project structure by making several directories for raw data, temporary/cache files, final outputs, rendered docs, and raw (non-rendered) docs. It also can initialise a Git repository (adding the cache directory to .gitignore and optionally adding & committing all changes), write a README file with recommended project instructions, and, if desired, connect the project to GitHub.

Usage

projr_init(
  dir_raw_data = "_raw_data",
  dir_cache = "_tmp",
  dir_docs = "docs",
  dir_output = "_output",
  dir_reference = "_reference",
  init_git = TRUE,
  git_add_and_commit_all = TRUE,
  init_readme = TRUE,
  init_github = TRUE,
  github_private = TRUE
)

Arguments

dir_raw_data

Character. Directory for raw data. Defaults to "_raw_data". Set to NULL to skip creating this directory.

dir_cache

Character. Directory for temporary or cache files. Defaults to "_tmp". Set to NULL to skip.

dir_docs

Character. Directory for rendered documents. Defaults to "docs". Set to NULL to skip.

dir_output

Character. Directory for final outputs. Defaults to "_output". Set to NULL to skip.

dir_reference

Character. Directory for non-rendered docs. Defaults to "_reference". Set to NULL to skip.

init_git

Logical. If TRUE (the default), initialises a Git repository in the current project.

git_add_and_commit_all

Logical. If TRUE (the default), attempts to add and commit all untracked and modified files after Git initialisation.

init_readme

Logical. If TRUE (the default), creates a README file with recommended project instructions.

init_github

Logical. If TRUE, connects the project to GitHub via usethis::use_github(). Defaults to TRUE.

github_private

Logical. If TRUE (the default) and if GitHub is initialised (i.e. when init_github = TRUE), the GitHub repository is created as private. A message is issued to remind the user that collaborators must be added manually via GitHub settings.

Value

Invisibly returns TRUE when complete.

Details

The default behaviour is to create all standard directories, initialise Git (adding the cache directory to .gitignore and committing changes), and write a README. If you do not wish to create one or more of the directories, pass NULL for that parameter.

Examples

if (FALSE) { # \dontrun{
projr_init(
  dir_raw_data = "_raw_data",
  dir_cache = "_tmp",
  dir_docs = "docs",
  dir_output = "_output",
  dir_reference = "_reference",
  init_git = TRUE,
  git_add_and_commit_all = TRUE,
  init_readme = TRUE,
  init_github = TRUE,
  github_private = TRUE
)
} # }