Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

irequire

Require a Package with User Interaction


Description

Like base require, irequire tries to find and load a package, but in an interactive way, i.e. offering the user to install it if not found.

Usage

irequire(
  package,
  lib = NULL,
  ...,
  load = TRUE,
  msg = NULL,
  quiet = TRUE,
  prependLF = FALSE,
  ptype = c("CRAN-like", "BioC", "BioCsoft", "BioCann"),
  autoinstall = !interactive()
)

Arguments

package

name of the package

lib

path to the directory (library) where the package is to be looked for and installed if agreed by the user.

...

extra arguments passed to install.packages.

load

a logical that indicates if the package should be loaded, possibly after installation.

msg

message to display in case the package is not found when first trying to load/find it. This message is appended to the string "Package '<packagename>' is required".

quiet

logical that indicates if loading a package should be done quietly with require.quiet or normally with require.

prependLF

logical that indicates if the message should start at a new line.

ptype

type of package: from CRAN-like repositories, Bioconductor, Bioconductor software, Bioconductor annotation. Bioconductor packages are installed using biocLite from the BiocInstaller package or fetched on line at http://bioconductor.org/biocLite.R.

autoinstall

logical that indicates if missing packages should just be installed without asking with the user, which is the default in non-interactive sessions.

Value

TRUE if the package was successfully loaded/found (installed), FALSE otherwise.

See Also

Other require: require.quiet()


pkgmaker

Development Utilities for R Packages

v0.32.2
GPL (>= 2)
Authors
Renaud Gaujoux [aut, cre]
Initial release
2020-10-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.