Learn R Programming

quickcode (version 1.0.6)

libraryAll: Load specific R libraries and clear environment

Description

Load specific packages, print a list of the loaded packages along with versions. Only include libraries, don't install if library doesn't exist

Usage

libraryAll(
  ...,
  lib.loc = NULL,
  quietly = FALSE,
  clear = TRUE,
  clearPkgs = FALSE
)

Value

loaded libraries and clear environment

Arguments

...

multiple library names

lib.loc

OPTIONAL. library store location

quietly

OPTIONAL. attach library quietly

clear

OPTIONAL. clear environment after attach

clearPkgs

Clear previous loaded packages, TRUE or FALSE

Examples

Run this code
# \donttest{
# load packages and print their versions to the console
libraryAll(base) #one package

libraryAll(
  base,
  tools,
  stats
) #multiple packages

libraryAll("grDevices") #with quotes

libraryAll(
  stats,
  utils,
  quietly = TRUE
) #load quietly

libraryAll(
  base,
clear = FALSE) #do not clear console after load

# clear previously loaded packages, then load r2resize and r2social
libraryAll(
  stats,
  utils,
  clearPkgs = TRUE
)
# }

Run the code above in your browser using DataLab