Learn R Programming

starter (version 0.1.16)

create_project: Start a new project

Description

Creates a directory with the essential files for a new project. The function can be used on existing project directories as well. Existing files will not be overwritten; rather, the user will be prompted whether to replace the existing file with the template file.

Usage

create_project(
  path,
  path_data = NULL,
  template = "default",
  git = TRUE,
  renv = TRUE,
  symlink = git,
  renv.settings = NULL,
  overwrite = NA,
  open = interactive()
)

Value

NULL, places project template in new or existing directory

Arguments

path

A path. If it exists, it is used. If it does not exist, it is created.

path_data

A path. The directory where the secure data exist. Default is NULL. When supplied, a symbolic link to data folder will be created.

template

A project template. See vignette for details.

git

Logical indicating whether to create Git repository. Default is TRUE When NA, user will be prompted whether to initialise Git repo.

renv

Logical indicating whether to add renv to a project. Default is TRUE. When NA user is asked interactively for preference.

symlink

Logical indicating whether to place a symbolic link to the location in path_data=. Default is to place the symbolic link if the project is a git repository.

renv.settings

A list of renv settings passed to renv::scaffold(settings=)

overwrite

Logical indicating whether to overwrite existing files if they exist. Options are TRUE, FALSE, and NA (aka ask interactively). Default is NA

open

Logical indicating whether to open new project in fresh RStudio session

Personalized Template

Users can create a personalized project template. Check out the vignette for step by step instructions.

Author

Daniel D. Sjoberg

See Also

Examples

Run this code
if (FALSE) { # pkgdown::in_pkgdown()
# specifying project folder location (folder does not yet exist)
project_path <- file.path(tempdir(), "My Project Folder")

# creating folder where secure data would be stored (typically will be a network drive)
secure_data_path <- file.path(tempdir(), "secure_data")
dir.create(secure_data_path)

# creating new project folder
create_project(project_path, path_data = secure_data_path)
}

Run the code above in your browser using DataLab