Skip to contents

Downloads a public GitHub repository that holds one or more metacheck modules and saves it in the metacheck user data directory, so its modules can be used by name in module_run(), report(), module_list() and module_help(), like the built-in modules.

Usage

module_install(repo, ref = NULL, overwrite = FALSE)

Arguments

repo

GitHub repository in "owner/repo" format, or its URL

ref

the branch, tag or commit to install (defaults to the repository's default branch)

overwrite

whether to replace the repository if it is already installed

Value

a data frame of the installed repository (see module_installed()), invisibly

Details

A module is an .R file with a roxygen header, as made by module_template(). Every such file in the top folder of the repository, or in a folder called modules/, is installed as a module. Other files (helper code, data, tests) are saved with the repository, but are not listed as modules.

A module can run other modules with module_run() and include their results in its own report with module_report(), so running one module (e.g. report(paper, modules = "my_check")) gives one report for all of its checks.

A module can state the lowest metacheck version it needs with a line #' @metacheck 0.3.4 in its header; it then refuses to install or run with an older metacheck. External modules should only use exported metacheck functions: internal functions can change without notice.

A module names the R packages it needs with #' @import pkg or #' @importFrom pkg fun. A package that is not on CRAN is named with its GitHub repository, #' @import owner/pkg: the package pkg is then loaded, and when it is not installed, module_install() and module_run() say to install it with remotes::install_github("owner/pkg") instead of install.packages().

Nothing is saved when a module in the repository has the same name as a built-in module, a module from another installed repository, or another module in the same repository.

Modules are saved in the metacheck user data folder, which belongs to the user who installs them. To share installed modules between users (for example with the user a Shiny Server runs apps as), set the environment variable METACHECK_MODULES_DIR to a folder all of them can read, both when installing and when using the modules.

Installing a module means running its code whenever you use it: only install modules from repositories you trust.

Examples

if (FALSE) { # \dontrun{
module_install("owner/repo")
module_run(demopaper(), "module_name")
} # }