Check Package Installation Status and Install If Missing Upon Request

InstallPackagesIfNotAlready(
  pkgs,
  install_if_not = TRUE,
  return_status = FALSE,
  verbose = FALSE
)

Arguments

pkgs

(character vector) names of packages to check installation status.

install_if_not

(logical) whether to install missing packages or not.

return_status

(logical) whether to return package installation status or not.

verbose

(logical) whether to print package installation status or not.

Value

if install_if_not is TRUE, then return a data.frame consisting of the installation status. The data.frame has two columns: "Before" and "After" indicating the status before and after the function InstallPackagesIfNotAlready is executed. Further, its rows are named after the packages names as specified in pkgs.

Examples

if (FALSE) { InstallPackagesIfNotAlready( pkgs = c("MASS", "knitr"), install_if_not = TRUE, return_status = FALSE, verbose = FALSE ) }