Skip to contents

This function creates a standard directory structure for a new R project.

Usage

initialize_project(
  project_name,
  path = ".",
  overwrite = FALSE,
  create_rproj = TRUE,
  include_models = TRUE,
  include_notebooks = TRUE
)

Arguments

project_name

The name of the project. This will be the name of the main project directory.

path

The path where the project directory should be created. Defaults to the current working directory.

overwrite

Logical, if TRUE, and a directory with `project_name` already exists, it will be overwritten (use with caution). Defaults to FALSE.

create_rproj

Logical, if TRUE, creates an RStudio project file (.Rproj). Defaults to TRUE.

include_models

Logical, if TRUE, includes a 'models' folder. Defaults to TRUE.

include_notebooks

Logical, if TRUE, includes a 'notebooks' or 'reports' folder. Defaults to TRUE.

Value

Invisibly returns the path to the created project directory.

Examples

if (FALSE) { # \dontrun{
# Create a project named "MyAnalysis" in the current directory
# initialize_project("MyAnalysis")

# Create a project in a specific path
# temp_dir <- tempdir()
# initialize_project("MyTestProject", path = temp_dir)
# unlink(file.path(temp_dir, "MyTestProject"), recursive = TRUE) # Clean up
} # }