Package 'peacock'

Title: Quick Project Initialization with Templates
Description: Streamline project setup by initializing directory structures with pre-configured templates. Create Shiny applications, research projects, and tool comparison studies with organized folders and starter files. Stop recreating the same structure manually and start coding faster.
Authors: Samuel Bharti [aut, cre]
Maintainer: Samuel Bharti <[email protected]>
License: MIT + file LICENSE
Version: 0.2.0
Built: 2026-07-14 08:52:23 UTC
Source: https://github.com/samuelbharti/peacock

Help Index


Initialize a reproducible analysis project

Description

Scaffolds a tidy directory layout for a data-analysis / research project: raw and processed data, analysis notebooks, reusable R functions, and outputs.

Usage

init_analysis(path = getwd(), confirm = TRUE)

Arguments

path

Path where the project is created.

confirm

Logical. If TRUE, prompts for confirmation before creating the project (interactive sessions only).

Value

Invisibly, the path the project was created in.

Examples

init_analysis(path = tempdir(), confirm = FALSE)

A changelog markdown template to document project progress

Description

A changelog markdown template to document project progress

Usage

init_changelog_md(path = getwd(), confirm = TRUE)

Arguments

path

Path where markdown file is created

confirm

Confirm path; logical input.

Value

Return markdown file in specified or current working directory

Examples

init_changelog_md(path = tempdir(), confirm = FALSE)

Initialize a Python project

Description

Scaffolds a modern Python project (src layout) with a pyproject.toml configured for ruff and pytest, a starter package and test, and agent guidance. peacock stays an R package; this simply emits Python project files.

Usage

init_python(path = getwd(), confirm = TRUE)

Arguments

path

Path where the project is created. The project name is taken from the final path component; the importable module name is derived from it.

confirm

Logical. If TRUE, prompts for confirmation before creating the project (interactive sessions only).

Value

Invisibly, the path the project was created in.

Examples

init_python(path = file.path(tempdir(), "my_pkg"), confirm = FALSE)

Initialize a Quarto project

Description

Scaffolds a starter Quarto project: a website, a book, or a manuscript, with a ⁠_quarto.yml⁠ and starter documents.

Usage

init_quarto(
  path = getwd(),
  type = c("website", "book", "manuscript"),
  confirm = TRUE
)

Arguments

path

Path where the project is created.

type

Project type: one of "website", "book", or "manuscript".

confirm

Logical. If TRUE, prompts for confirmation before creating the project (interactive sessions only).

Value

Invisibly, the path the project was created in.

Examples

init_quarto(path = tempdir(), confirm = FALSE)

Initialize Shiny Project using this function

Description

Initialize Shiny Project using this function

Usage

init_shiny(path = getwd(), confirm = TRUE)

Arguments

path

Path where shiny project template is created

confirm

Logical. If TRUE, prompts user for confirmation before creating template.

Value

Return shiny project file and directory template in current working directory.

Examples

## Not run: 
init_shiny()

## End(Not run)

Initialize a project from a GitHub template repository

Description

Downloads a template repository from GitHub and unpacks it into path. The template can be a built-in name (see peacock_templates()) or any GitHub repository given as "owner/repo" or "owner/repo@ref".

Usage

init_template(
  template_name = "shiny",
  path = getwd(),
  ref = NULL,
  registry = NULL,
  confirm = TRUE
)

Arguments

template_name

A built-in template name (e.g. "shiny", "cgds"), or a GitHub repository as "owner/repo" / "owner/repo@ref". Defaults to "shiny".

path

Path where the project template will be created.

ref

Optional branch, tag, or commit to download. Overrides an ⁠@ref⁠ given in template_name. Defaults to the template's registry ref, or the repository's default branch (HEAD).

registry

Optional path to a custom registry file (DCF or YAML); see peacock_templates(). Defaults to the registry bundled with peacock.

confirm

Logical. If TRUE, prompts for confirmation before creating the template (interactive sessions only).

Value

Invisibly, the path the template was created in.

Examples

## Not run: 
init_template("shiny")
init_template("owner/repo@dev", path = tempdir())

## End(Not run)

List the built-in project templates

Description

Returns the registry of curated templates that init_template() understands by short name. You can also pass any GitHub "owner/repo" (optionally "owner/repo@ref") to init_template() without it being in this registry.

Usage

peacock_templates(registry = NULL)

Arguments

registry

Optional path to a custom registry file. .dcf files are read with base R; .yaml/.yml files require the yaml package. Defaults to the registry bundled with peacock.

Value

A data frame of available templates with columns Name, Repo, Ref, and Description.

Examples

peacock_templates()

Initialize a project directory structure for tool review

Description

Initialize a project directory structure for tool review

Usage

tool_review_template(tool_name, tool_url, path = getwd(), confirm = TRUE, ...)

Arguments

tool_name

A vector of tool names

tool_url

A vector of corresponding tool URLs

path

Path to initial project directory

confirm

User confirmation enable for setup

...

Additional arguments (currently unused)

Value

Return project structure in specified directory

Examples

## Not run: 
tool_review_template("abc","www.abc.com")

## End(Not run)