packages.loaded {NCmisc} | R Documentation |
Check whether a set of packages has been loaded
Description
Returns TRUE if the whole set of packages entered has been loaded, or FALSE otherwise. This can be useful when developing a package where there is optional functionality depending if another package is in use (but the other package is not part of 'depends' because it is not essential). Because 'require' cannot be used within functions submitted as part of a CRAN package.
Usage
packages.loaded(pcks = "", ..., cran.check = FALSE, repos = getRepositories())
Arguments
pcks |
character, a package name, or vector of names, if left blank will return all loaded |
... |
further package names as character (same as entering via pcks, but avoids need for c() in pcks) |
cran.check |
logical, in the case at least one package is not found, whether to search CRAN and see whether the package(s) even exist on CRAN. |
repos |
repository to use if package is not loaded and cran.check=TRUE, if NULL, will attempt to use the repository in getOptions("repos") or will default to the imperial.ac.uk mirror. Otherwise the default is to use all available repositories from getRepositories() |
Value
logical TRUE or FALSE whether the whole list of packages are available
Author(s)
Nicholas Cooper
Examples
packages.loaded("NCmisc","reader")
packages.loaded() # no argument means all loaded packages are listed