View source: R/setup-project.R
proj_setup | R Documentation |
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.
proj_setup(
project_name,
python = TRUE,
python_version = NULL,
python_pkgs = NULL
)
project_name |
The name of the project which should match the end of the current working directory's path. |
python |
Logical, if |
python_version |
The version of Python to use for the virtual environment.
If |
python_pkgs |
A character vector of additional Python packages to install in the virtual environment, beyond the defaults (matplotlib, numpy, pandas). |
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.
NULL This function is used for its side effect of creating directories and optionally a Python virtual environment. It does not return any value.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.