Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tryRequire

Error-free test for requiring a package


Description

This function reliably tries to attach a package and silently returns FALSE if the package cannot be attached. Unlike require, it does not generate an error if the package exists but cannot be attached (e.g., because of version requirements).

Usage

tryRequire(what)

Arguments

what

The name of the package

Details

The function intends to run silently, but this is not uniformly possible, since the quietly = TRUE option to require() does not suppress messages from other packages attached through dependencies in this package.

The value is not returned invisibly, as it would be with require().

Value

TRUE if the package was successfully attached and FALSE otherwise.

Examples

tryRequire(RSPerl)

SoDA

Functions and Examples for "Software for Data Analysis"

v1.0-6.1
GPL (>= 2)
Authors
John M Chambers
Initial release
2014-06-12

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.