Skip to contents

Prerequisites

High level overview of the package

rcompendium-package rcompendium
Create a package or research compendium structure

Setup functions

These four functions are usually the only ones user needs to run. The use of set_credentials is strongly recommended to permanently store user information (name, email, orcid, etc.) in the .Rprofile. This function must be run one time. The function new_package must be used to create an R package structure whereas new_compendium creates a new research compendium structure (i.e. R package structure with some additional files/folders). After that user can start to develop his/her project and run refresh to frequently update the package/compendium components (Rd files, NAMESPACE, dependencies, badges, README.md, etc.)

set_credentials()
Store credentials to the .Rprofile
new_package()
Create an R package structure
new_compendium()
Create an R compendium structure
refresh()
Refresh a package/research compendium

Create files

These function write files specific to R package and research compendium (add_makefile). They are called by the main functions new_package, new_compendium, and refresh but they also can be used to overwrite files (with overwrite = TRUE) in case of broken code. When open = TRUE and overwrite = FALSE (default) files are open in the editor.

add_description()
Create a DESCRIPTION file
add_license()
Add a LICENSE
add_package_doc()
Create a package-level documentation file
add_citation()
Create a CITATION file
add_code_of_conduct()
Add code of conduct
add_contributing()
Add contribution guidelines
add_testthat()
Initialize units tests
add_vignette()
Create a vignette document
add_readme_rmd()
Create a README file
add_compendium()
Create additional folders
add_makefile()
Create a Make-like R file
add_renv()
Initialize renv
add_dockerfile()
Create a Dockerfile

README badges

These functions add badges to the README.Rmd. They are called by the main functions new_package, new_compendium, and refresh but they also can be used to update badges if license, lifecycle, repository status change or to update number of dependencies (add_dependencies_badge).

add_cran_badge()
Add a CRAN Status badge
add_dependencies_badge()
Add a Dependencies badge
add_license_badge()
Add a License badge
add_lifecycle_badge()
Add a Life Cycle badge
add_repostatus_badge()
Add a Repository Status badge
add_github_actions_check_badge()
Add a R CMD Check badge
add_github_actions_pkgdown_badge()
Add a Website badge
add_github_actions_codecov_badge()
Add a Test coverage badge
add_codecov_badge()
Add a Codecov badge

Advanced functions

These functions update fields in DESCRIPTION (add_dependencies and add_r_depend), edit files (add_to_gitignore and add_to_buildignore), or write configuration files (add_github_actions_check, add_github_actions_pkgdown, add_github_actions_codecov, and add_github_actions_render).

add_dependencies()
Add dependencies in DESCRIPTION
add_r_depend()
Add minimal R version to DESCRIPTION
add_to_gitignore()
Add to the .gitignore file
add_to_buildignore()
Add to the .Rbuildignore file
add_github_actions_check()
Setup GitHub Actions to check package
add_github_actions_pkgdown()
Setup GitHub Actions to build and deploy package website
add_github_actions_codecov()
Setup GitHub Actions to report code coverage
add_github_actions_render()
Setup GitHub Actions to render README
add_github_actions_citation()
Setup GitHub Actions to update CITATION.cff
add_github_actions_document()
Setup GitHub Actions to document package

Utilities functions

These functions return objects but do not edit any file.

get_licenses()
List all available licenses
get_all_dependencies()
Get all external dependencies
get_all_functions()
List all functions in the package
get_minimal_r_version()
Get required minimal R version