
Initialize a new R project with a standard folder structure
Source:R/init-project.R
init_project.Rdinit_project() creates a new R project at the given path with an
opinionated folder structure suited for research workflows. It optionally
initializes renv for package management and git for version control.
Arguments
- file_path
A character string with the path and name of the new project (e.g.,
"~/Documents/my-project").- use_renv
Logical. If
TRUE, initializesrenvin the new project. Defaults toTRUE.- use_git
Logical. If
TRUE, initializes a git repository in the new project. Defaults toTRUE.- extra_folders
A character vector of additional folder names to create inside the project. Defaults to
NULL.- open
Logical. If
TRUE, opens the new project in RStudio after creation. Defaults toTRUE.
Examples
if (FALSE) { # \dontrun{
# Create a project with the standard folder structure
init_project("~/Documents/my-project")
# Create a project with an additional folder
init_project("~/Documents/my-project", extra_folders = c("notebooks", "presentations"))
# Create a project without renv or git
init_project("~/Documents/my-project", use_renv = FALSE, use_git = FALSE)
} # }