File: isPackageInstalled.R

package info (click to toggle)
r-cran-r.utils 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,936 kB
  • sloc: sh: 18; makefile: 6
file content (46 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download
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.
############################################################################