/rcompendium

:package: Create a Package or Research Compendium Structure

Primary LanguageRGNU General Public License v2.0GPL-2.0

rcompendium

R CMD check Website deployment Test coverage codecov CRAN status License: GPL (>= 2) LifeCycle Project Status: Active Dependencies

In the area of open science, making reproducible analyses is a strong prerequisite. But sometimes it is difficult 1) to find the good structure for organizing files and 2) to setup the whole project.

The purpose of the package rcompendium is to make easier the creation of R package/research compendium (i.e. a predefined files/folders structure) so that user can focus on the code/analysis instead of wasting time organizing files.

A full ready-to-work structure will be set up with the following features:

  • Initialization of the GIT versioning.
  • Creation of a minimal R package structure (DESCRIPTION and NAMESPACE files, and R/ and man/ folders).
  • Creation of additional files (LICENSE.md, inst/CITATION, etc.).
  • Creation of a Get started vignette in vignettes/.
  • Creation of a GitHub README.Rmd with HexSticker (template) and badges.
  • Autocompletion of maintainer information.
  • Creation of the GitHub repository.
  • Configuration of GitHub Actions to automatically:
    • check and test package;
    • build and deploy website (using pkgdown).

Overview

The strength of rcompendium is to create the whole structure in one command line by using the function new_package() (or new_compendium()). The default settings will produce the following structure:

.
│
├── pkg.Rproj                 # (optional) Created by user 
│
├── .git/                     # GIT tracking folder
├── .gitignore                # Specific to R packages
|
├── .github/                  # (optional) GitHub Actions settings
│   └── workflows/
│       ├── pkgdown.yaml      # Configuration file to build & deploy website
│       └── R-CMD-check.yaml  # Configuration file to check & test package
│
├── _pkgdown.yaml             # (optional) User website settings
│
├── R/                        # R functions
│   └── pkg-package.R         # Dummy R file for package-level documentation
│
├── man/                      # R functions helps (automatically updated)
│   ├── pkg-package.Rd        # Package-level documentation
│   └── figures/              # Figures for the README 
│       └── hexsticker.png    # Template R package HexSticker
│
├── inst/
│   └── CITATION              # BiBTeX entry to cite the R package       [*]
│
├── vignettes/
│   └── pkg.Rmd               # (optional) Package tutorial              [*]
│
├── DESCRIPTION               # Project metadata                         [*]
├── NAMESPACE                 # Automatically generated
├── .Rbuildignore             # Automatically generated
│
├── LICENSE                   # (optional) If License = MIT
├── LICENSE.md                # Content of the chosen license
│
├── README.md                 # GitHub README (automatically generated)
├── README.Rmd                # GitHub README (to knit)                  [*]
/
/
├── analysis/                 # Proposed compendium                      [¶]
│   ├── data/                 # User raw data (.csv, .gpkg, etc.)
│   ├── rscripts/             # R scripts (no functions) to run analyses
│   ├── outputs/              # Outputs created by R scripts
│   ├── figures/              # Figures created by R scripts
│   └── paper/                # Article based on analyses
│
└── make.R                    # Master R scripts to run all analyses     [¶]


[*] These files are automatically edited but user needs to add manually 
    some information.
[¶] These folders/files are also created when using new_compendium()

Installation

You can install the development version from GitHub with:

## Install < remotes > package (if not already installed) ----

if (!requireNamespace("remotes", quietly = TRUE)) {
  install.packages("remotes")
}


## Install dev version of < rcompendium > from GitHub ----

remotes::install_github("FRBCesab/rcompendium")

Getting started

Please read the Vignette and the documentation of the function new_package.

This repository was created by running:

rcompendium::new_package(organisation = "FRBCesab")

Citation

Please cite this package as:

Casajus N. (2021) rcompendium: An R package to create a package or research compendium structure. Version 0.1, https://github.com/FRBCesab/rcompendium.

You can also run:

citation("rcompendium")

## A BibTeX entry for LaTeX users is:
## 
## @Manual{,
##   title  = {{rcompendium}: {An} {R} package to create a package or research compendium structure},
##   author = {{Casajus N.}},
##   year   = {2021},
##   note   = {R package version 0.1},
##   url    = {https://github.com/FRBCesab/rcompendium},
## }

Contributing

You are welcome to contribute to the rcompendium project. Please read our Contribution Guidelines.

Please note that the rcompendium project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Colophon

This package is the result of intense discussions and feedbacks from the training course Data Toolbox for Reproducible Research in Computational Ecology (in French).

rcompendium was largely inspired by the package rrtools developed by Ben Marwick and tries to respect the standard defined by RStudio. It uses several functions from the packages devtools and usethis.

Thanks to these developer teams!