Learn R Programming

hutils (version 2.0.0)

RQ: Shorthand for requireNamespace

Description

Present since hutils v1.2.0. Alias for if (!requireNamespace(pkg, quietly = TRUE)) yes else no. Typical use-case would be RQ(pkg, install.packages("pkg"))].

Default values for yes and no from hutils v1.5.0.

This function is not recommended for use in scripts as it is a bit cryptic; its use-case is for bash scripts and the like where calls like this would otherwise be frequent and cloud the message.

Usage

RQ(pkg, yes = NULL, no = NULL)

Arguments

pkg

Package to test whether the package is not yet installed.

yes

Response if pkg is not installed.

no

(optional) Response if pkg is installed.

Examples

Run this code
if (FALSE) {
 RQ("dplyr", "dplyr needs installing")
}


Run the code above in your browser using DataLab