proj_setup: Set Up Project Directories with Optional Python Environment

View source: R/setup-project.R

proj_setupR Documentation

Set Up Project Directories with Optional Python Environment

Description

Initializes a new project directory structure in the current working directory. Verifies if the working directory's name matches the provided project name. If the names do not match, the execution is stopped with an error message. Optionally sets up a Python virtual environment and installs specified packages.

Usage

proj_setup(
  project_name,
  python = TRUE,
  python_version = NULL,
  python_pkgs = NULL
)

Arguments

project_name

The name of the project which should match the end of the current working directory's path.

python

Logical, if TRUE, sets up a Python virtual environment and script directories. Defaults to TRUE.

python_version

The version of Python to use for the virtual environment. If NULL, uses the system's default Python version.

python_pkgs

A character vector of additional Python packages to install in the virtual environment, beyond the defaults (matplotlib, numpy, pandas).

Details

The directories created are as follows:

  • data: Main directory for all data-related storage.

    • meta: For storing meta data.

    • raw: For storing raw, unmodified data.

    • proc: For storing processed data, which is derived from raw data.

    • out: For storing output data, such as results or final datasets.

  • docs: For documentation files related to the project.

  • figures: For figures (.ai, .svg, ...).

  • plots: For storing graphical representations generated from the data.

  • R_markdown: For storing R Markdown documents used for reports or presentations.

  • R_scripts: For storing R scripts that are part of the project.

  • py_scripts and py_venv: Created only if python is TRUE. The py_venv directory contains a Python virtual environment named venv_main with specified Python packages installed.

Value

NULL This function is used for its side effect of creating directories and optionally a Python virtual environment. It does not return any value.

Examples

# Set up a project named "MyProject" with a Python virtual environment
proj_setup("MyProject", python = TRUE, python_version = "3.8", python_pkgs = c("scipy", "seaborn"))

# Set up a project without a Python environment
proj_setup("MyProject", python = FALSE)


kueckelj/confuns documentation built on July 4, 2024, 4:53 p.m.