package_janitor_remote: checks the user's installed packages against the packages...

View source: R/package-janitor.R

package_janitor_remoteR Documentation

checks the user's installed packages against the packages listed in a CSV.

Description

CRAN packages are installed only if they're not already; then they're updated if available. GitHub packages are installed regardless if they're already installed. These packages are necessary for most of the analyses run by the OUHSC BBMC (https://github.com/OuhscBbmc).

We use https://github.com/OuhscBbmc/RedcapExamplesAndPatterns/blob/master/utility/package-dependency-list.csv. The undecorated version of this csv (which is better for computers, but harder for humans) is https://raw.githubusercontent.com/OuhscBbmc/RedcapExamplesAndPatterns/master/utility/package-dependency-list.csv.

Usage

package_janitor_remote(
  url_package_dependencies,
  cran_repo = "https://cran.rstudio.com",
  update_packages = TRUE,
  dependencies = TRUE,
  check_xml_linux = (R.Version()$os == "linux-gnu"),
  check_libcurl_linux = (R.Version()$os == "linux-gnu"),
  check_openssl_linux = (R.Version()$os == "linux-gnu"),
  verbose = TRUE
)

Arguments

url_package_dependencies

path to a csv containing the packages. See the description. Required.

cran_repo

path to a CRAN mirror.

update_packages

should package be updated first.

dependencies

Passed to the dependencies parameter of utils::install.packages()). Set to NA to avoid 'Suggests'.

check_xml_linux

display a message about the xml Linux package.

check_libcurl_linux

display a message about the libcurl Linux package.

check_openssl_linux

display a message about the openssl Linux package.

verbose

print messages to the console (or wherever messages are being directed).

Details

This code checks the user's installed packages against the packages listed in https://github.com/OuhscBbmc/RedcapExamplesAndPatterns/blob/master/utility/package-dependency-list.csv These packages are necessary for most of the analyses run by the OUHSC BBMC (https://github.com/OuhscBbmc).

CRAN packages are installed only if they're not already; then they're updated if available. GitHub packages are installed regardless if they're already installed.

If anyone encounters a package that should be on there, please add it to https://github.com/OuhscBbmc/RedcapExamplesAndPatterns/blob/master/utility/package-dependency-list.csv

There are two identical versions of this file. If in doubt, use the first option. 1. Stand-alone GitHub Gist: https://gist.github.com/wibeasley/2c5e7459b88ec28b9e8fa0c695b15ee3 2. R package on GitHub repo: https://github.com/OuhscBbmc/OuhscMunge/blob/master/R/package-janitor.R

To run this function on your local machine with the following three lines of code: if( !base::requireNamespace("devtools") ) utils::install.packages("devtools") devtools::source_gist("2c5e7459b88ec28b9e8fa0c695b15ee3", filename="package-janitor-bbmc.R") package_janitor_remote("https://raw.githubusercontent.com/OuhscBbmc/RedcapExamplesAndPatterns/master/utility/package-dependency-list.csv")

Author(s)

Will Beasley

Examples

## Not run: 
# This path works if the working directory is the root of the repo:
# https://github.com/OuhscBbmc/RedcapExamplesAndPatterns
package_janitor_remote("./utility/package-dependency-list.csv")

# Internet URLs are also accepted.
# Caution, this one takes at least 5 minutes.
url <- paste0(
  "https://raw.githubusercontent.com/OuhscBbmc/RedcapExamplesAndPatterns/",
  "master/utility/package-dependency-list.csv"
)
package_janitor_remote(url)

## End(Not run)

OuhscBbmc/OuhscMunge documentation built on Dec. 5, 2024, 4:34 a.m.