Skip to contents

Loads packages or, if not already installed, installs and loads packages.

Usage

load_or_install(package_names, ...)

Arguments

package_names

Character vector of one or more package names.

...

Additional arguments for install.packages().

Value

Loaded packages.

Details

Loads packages that are already installed, and if the packages are not already installed, it installs and then loads them.

Examples

if (FALSE) { # \dontrun{
old <- options("repos")
options(repos = "https://cran.r-project.org")
# Warning: the command below installs packages that are not already installed
load_or_install(c("tidyverse","nlme"))
options(old)
} # }




Developmental Psychopathology Lab