templates: Create Templates for Annotations and Code

View source: R/S03_Utilities.R

templatesR Documentation

Create Templates for Annotations and Code

Description

Outputs a template of common annotations and code segments to the console for easy copying and pasting.

Usage

templates(type = NULL, val = NULL)

Arguments

type

The type of template to return, with options for...

  • 'Function (function documentation);

  • 'Header' (header for a R script);

  • 'Package' (package version);

  • 'Progress' (progress bar for a loop);

  • 'Loop' (a for loop statement);

  • 'Conditional' (a if statement);

  • 'Roxygen2' (function documentation using Roxygen2);

  • 'recode' (values for the 'dplyr' function recode).

val

An optional character vector to be used with type = 'recode'.

Examples

# List of possible inputs to argument
# 'type' for each template
templates()

# Function documentation
templates("Function")

# Header for R script
templates("Header")

# Package version
templates("Package", "stats")

# Progress bar for loop
templates("Progress")

# Loop
templates("Loop")

# If ... else statement
templates("Conditional")

# Roxygen2 function documentation
templates("roxygen")

# HTML internal links
templates("html_links")

# Example table for specifying
# nomenclature and a glossary
# in a .Rmd file
templates("rmd_glossary")


rettopnivek/arfpam documentation built on Oct. 20, 2024, 7:24 p.m.