try_require: Check if Specific Package is Installed

View source: R/other_functions.R

try_requireR Documentation

Check if Specific Package is Installed

Description

This function checks library dependencies

Usage

try_require(package, stop = TRUE, load = TRUE, lib.loc = NULL, ...)

Arguments

package

Character. Name of the library

stop

Boolean. Stop if not installed. If FALSE and library is not available, warning will be shown.

load

Boolean. Load library?

lib.loc

Character vector. Location of R library trees to search through, or NULL. The default value of NULL corresponds to all libraries currently known to .libPaths(). Non-existent library trees are silently ignored.

...

Additional parameters.

Value

No return value, called for side effects.

See Also

Other Tools: autoline(), bind_files(), bring_api(), chr2num(), db_download(), db_upload(), export_plot(), export_results(), files_functions(), font_exists(), formatColoured(), formatHTML(), get_credentials(), glued(), grepm(), h2o_selectmodel(), haveInternet(), image_metadata(), importxlsx(), ip_data(), json2vector(), list_cats(), listfiles(), mail_send(), markdown2df(), move_files(), msplit(), myip(), quiet(), read.file(), statusbar(), tic(), updateLares(), warnifnot(), what_size()

Examples

# Check if library base is installed. If not, stop and show error
try_require("base", stop = TRUE)
# Check if library xxx is installed. If not, show warning
try_require("xxx", stop = FALSE)

lares documentation built on Sept. 13, 2024, 1:08 a.m.