use_pkg: Attach and if necessary install a package

View source: R/use_pkg.R

use_pkgR Documentation

Attach and if necessary install a package

Description

First, use_package checks if the package is installed. If not already installed, the package will be installed. Thereafter, the package is attached using library.

Usage

use_pkg(pkg, repos = "https://cran.uib.no/", ...)

Arguments

pkg

[character]
Name of one or more packages.

repos

[character(1)]
The base URL(s) of the repositories to use, e.g., the URL of a Cran mirror such as "https://cloud.r-project.org". Can be NULL to install from local files, directories or URLs: this will be inferred by extension from pkgs if of length one. Defaults to "https://cran.uib.no/".

...

Other arguments to be passed to utils::install.packages.

Details

Only packages available at Cran can be installed.

Examples

use_pkg("checkmate")
use_pkg(pkg = c("checkmate", "devtools"))


NorwegianVeterinaryInstitute/NVIbatch documentation built on Dec. 15, 2024, 3:15 p.m.