Package 'template'

Title: Generic template for data analysis projects structured as R packages
Description: This package works as a template for new research or data analysis projects, under the idea of having everything (data, R scripts, functions and manuscript/reports) contained in the same package (a 'research compendium') to facilitate collaboration and promote reproducibility.
Authors: Francisco Rodriguez-Sanchez [aut, cre]
Maintainer: Francisco Rodriguez-Sanchez <[email protected]>
License: CC0
Version: 0.5.3
Built: 2024-09-16 03:46:27 UTC
Source: https://github.com/Pakillo/template

Help Index


template package

Description

Generic template for research projects structured as R packages. This package works as a template for new research projects, under the idea of having everything (data, R scripts, functions and manuscripts) contained in the same package to promote reproducibility.

Details

For detailed steps on how to use the package see https://github.com/Pakillo/template/blob/master/README.md.

Author(s)

Francisco Rodriguez-Sanchez


How to document datasets.

Description

This is an example showing how to document datasets included in the package (in data folder): you must specify docType and name; do not forget NULL in the end. Can include other fields, like citation. See http://r-pkgs.had.co.nz/data.html for further explanations.

Format

A numeric vector.

Source

This example modified from C. Boettiger's template package https://github.com/cboettig/template.

Examples

## Not run: 
data(exampledataset)
str(exampledataset)

## End(Not run)

How to document functions.

Description

This is an example showing how to document functions to be included in the package.

Usage

examplefunction(text)

Arguments

text

Message to print.

Author(s)

Francisco Rodriguez-Sanchez

See Also

http://r-pkgs.had.co.nz/man.html

Examples

examplefunction('Hello world!')

Create new project scaffolding

Description

Create all the scaffolding for a new project in a new directory. The scaffolding includes a README file, different folders to hold raw data, analyses, etc, and optionally also testthat infrastructure. Also, optionally, set a private or public GitHub repo with continuous integration (Travis-CI, GitHub Actions...).

Usage

new_project(
  name,
  path = ".",
  package = TRUE,
  github = FALSE,
  private.repo = TRUE,
  ci = "none",
  makefile = TRUE,
  pipe = TRUE,
  testthat = FALSE,
  verbose = FALSE,
  open.project = TRUE
)

Arguments

name

Character. Name of the new project. A new folder will be created with that name.

path

Character. Path where the new project should be created (default is the current working directory).

package

Logical. Create package structure or a simple project?

github

Logical. Create GitHub repository? Note this requires some working infrastructure like git and a GITHUB_PAT. See instructions here https://usethis.r-lib.org/articles/articles/usethis-setup.html.

private.repo

Logical. Default is TRUE.

ci

Logical. Use continuous integration in your GitHub repository? Current options are "none" (default), "travis" (uses Travis-CI), "circle" (uses Circle-CI), "appveyor" (uses AppVeyor), or "gh-actions" (uses GitHub Actions).

makefile

Logical. If TRUE, adds a template makefile.R file to the project.

pipe

Logical. Use magrittr's pipe in your package?

testthat

Logical. Add testthat infrastructure?

verbose

Print verbose output in the console while creating the new project? Default is FALSE.

open.project

Logical. If TRUE (the default) will open the newly created Rstudio project in a new session.

Details

If using github = TRUE, you will be asked if you want to commit some files. Reply positively to continue.

Value

A new directory with R package structure, slightly modified.

Examples

## Not run: 
library("template")
new_project("myproject")
new_project("myproject", github = TRUE, private.repo = TRUE)

## End(Not run)