Installs, loads, and attaches package(s). If package(s) are not installed, installs them prior to loading and attaching.
prep(
...,
pkg_names_as_object = FALSE,
silent_if_successful = FALSE,
silent_load_pkgs = NULL
)
there will be no output from this function. Rather, packages given as inputs to the function will be installed, loaded, and attached.
names of packages to load and attach, separated by commas,
e.g., "ggplot2", data.table
. The input can be any number
of packages, whose names may or may not be wrapped in quotes.
logical. If pkg_names_as_object = TRUE
,
the input will be evaluated as one object containing package names.
If pkg_names_as_object = FALSE
, the input will be considered
as literal packages names (default = FALSE).
logical. If silent_if_successful = TRUE
,
no message will be printed if preparation of package(s) is successful.
If silent_if_successful = FALSE
, a message indicating which
package(s) were successfully loaded and attached will be printed
(default = FALSE).
a character vector indicating names of
packages to load silently (i.e., suppress messages that get printed
when loading the packaged). By default, silent_load_pkgs = NULL
# \donttest{
prep(data.table)
prep("data.table", silent_if_successful = TRUE)
prep("base", utils, ggplot2, "data.table")
pkgs <- c("ggplot2", "data.table")
prep(pkgs, pkg_names_as_object = TRUE)
prep("data.table", silent_load_pkgs = "data.table")
# }
Run the code above in your browser using DataLab