require.nowarnings {excursions} | R Documentation |
Warnings free loading of add-on packages
Description
Turn off all warnings for require(), to allow clean completion of examples that require unavailable Suggested packages.
Usage
require.nowarnings(package, lib.loc = NULL, character.only = FALSE)
Arguments
package |
The name of a package, given as a character string. |
lib.loc |
a character vector describing the location of R library trees
to search through, or |
character.only |
a logical indicating whether |
Details
require(package)
acts the same as
require(package, quietly = TRUE)
but with warnings turned off.
In particular, no warning or error is given if the package is unavailable.
Most cases should use requireNamespace(package, quietly = TRUE)
instead,
which doesn't produce warnings.
Value
require.nowarnings
returns (invisibly) TRUE
if it succeeds, otherwise FALSE
See Also
Examples
## This should produce no output:
if (require.nowarnings(nonexistent)) {
message("Package loaded successfully")
}