usethis (version 1.3.0)

create_package: Create a package or project

Description

These functions create an R project:

  • create_package() creates an R package

  • create_project() creates a non-package project, i.e. a data analysis project

Both functions can add project infrastructure to an existing directory of files or can create a completely new project. Both functions change the active project, so that subsequent use_*() calls affect the project that you've just created. See proj_set() to manually reset it.

Usage

create_package(path, fields = getOption("devtools.desc"),
  rstudio = rstudioapi::isAvailable(), open = interactive())

create_project(path, rstudio = rstudioapi::isAvailable(), open = interactive())

Arguments

path

A path. If it exists, it is used. If it does not exist, it is created, provided that the parent path exists.

fields

A named list of fields to add to DESCRIPTION, potentially overriding the defaults. If NULL, retrieved from getOption("usethis.description"), and (for backward compatibility) from getOption("devtools.desc").

rstudio

If TRUE, calls use_rstudio() to make the new package or project into an RStudio Project. If FALSE and a non-package project, a sentinel .here file is placed so that the directory can be recognized as a project by the here or rprojroot packages.

open

If TRUE and in RStudio, the new project is opened in a new instance, if possible, or is switched to, otherwise. If TRUE and not in RStudio, working directory is set to the new project.