Initialize a projr Project
projr_init.RdThis function performs a full initialization of a projr project. It sets up the project structure by creating directories, generating a README (in Markdown or R Markdown format), configuring a renv environment, writing a DESCRIPTION file, applying a license (if provided), setting up citation files, creating a projr configuration YAML file, establishing literate documentation, and configuring both Git and GitHub repositories.
Usage
projr_init(
git = TRUE,
git_commit = TRUE,
github = TRUE,
github_public = FALSE,
github_org = NULL,
dir = TRUE,
readme = TRUE,
readme_rmd = TRUE,
desc = FALSE,
license = NULL,
projr_yml = FALSE,
lit_doc = NULL
)
projr_init_all(
github = TRUE,
github_org = NULL,
license = NULL,
lit_doc = NULL
)
projr_init_renv(bioc = TRUE)
projr_init_cite()
projr_init_git(commit = TRUE)
projr_init_github(username = NULL, public = FALSE)
projr_init_license(license, first_name, last_name)Arguments
- git
Logical. If
TRUE, initializes a Git repository. Defaults toTRUE.- git_commit
Logical. If
TRUE, commits the initial changes to the Git repository. Defaults toTRUE.- github
Logical. If
TRUE, attempts to create a GitHub repository for the project. Defaults toTRUE.- github_public
Logical. If
TRUE, the GitHub repository will be public. Defaults toFALSE.- github_org
Character or
NULL. The GitHub organization under which to create the repository. Defaults toNULL, which creates the repository under the user's account (as implied by the GitHub token).- dir
Logical. If
TRUE, initializes the projr-specified directories (e.g., raw, cache, output). Defaults toTRUE.- readme
Logical. If
TRUE, creates a README file. Defaults toTRUE.- readme_rmd
Logical. If
TRUE, generates a README in R Markdown format (README.Rmd); otherwise, a Markdown file (README.md) is created. Defaults toTRUE.- desc
Logical. If
TRUE, creates a DESCRIPTION file for the project. Defaults toFALSE.- license
Character or
NULL. Specifies the license to apply (e.g.,"ccby","apache","cc0","proprietary"). Defaults toNULL.- projr_yml
Logical. If
TRUE, creates aprojr.ymlconfiguration file. Defaults toFALSE.- lit_doc
Character or
NULL. Specifies the type of literate documentation to create. Supported values are"bookdown","project","quarto", and"rmd". Defaults toNULL.- bioc
Logical (for
projr_init_renv). IfTRUE, includes Bioconductor packages in the renv setup. Defaults toTRUE.- commit
Logical (for
projr_init_git). IfTRUE, commits the initial changes to the Git repository. Defaults toTRUE.- username
Character or
NULL(forprojr_init_github). The GitHub username or organization under which to create the repository. Defaults toNULL.- public
Logical (for
projr_init_github). IfTRUE, the GitHub repository will be public. Defaults toFALSE.- first_name
Character (for
projr_init_license). First name for proprietary license. Required whenlicense = "proprietary".- last_name
Character (for
projr_init_license). Last name for proprietary license. Required whenlicense = "proprietary".
Value
Invisibly returns TRUE if initialization is successful, or FALSE if
a particular step is skipped.
Details
The projr_init function is a wrapper that calls several helper functions to
perform the following tasks:
Prevent working directory errors by ensuring the usethis project is set.
Create project directories.
Generate a README file (in Markdown or R Markdown format).
Initialize a renv environment, optionally with Bioconductor support.
Write a DESCRIPTION file for project metadata.
Apply a specified license.
Configure citation files (if a DESCRIPTION file exists).
Create a projr configuration YAML file.
Set up literate documentation in the chosen format.
Initialize Git (and optionally commit initial changes).
Create a GitHub repository if requested.