1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
###########################################################################/**
# @RdocDefault isPackageInstalled
#
# @title "Checks if a package is installed or not"
#
# \description{
# @get "title".
# }
#
# @synopsis
#
# \arguments{
# \item{package}{A @character @vector of package names.}
# \item{...}{Not used.}
# }
#
# \value{
# Returns a @logical @vector.
# }
#
# @author
#
# \seealso{
# @see "isPackageLoaded".
# }
#
# @keyword utilities
# @keyword package
#*/###########################################################################
setMethodS3("isPackageInstalled", "default", function(package, ...) {
suppressWarnings({
paths <- sapply(package, FUN=function(p) system.file(package=p));
});
(paths != "");
})
############################################################################
# HISTORY:
# 2014-04-06
# o Vectorized isPackageInstalled().
# 2013-08-30
# o Now isPackageInstalled() suppresses warnings.
# 2009-01-11
# o Created.
############################################################################
|