Learn R Programming

evanverse (version 0.4.0)

check_pkg: Check Package Installation Status

Description

Check whether packages are installed and optionally install missing ones. Internally calls inst_pkg() for auto-installation.

Usage

check_pkg(
  pkg = NULL,
  source = c("CRAN", "GitHub", "Bioconductor"),
  auto_install = TRUE,
  ...
)

Value

A tibble with columns: package, name, installed, source.

Arguments

pkg

Character vector. Package names or GitHub repos (e.g., "user/repo").

source

Character. Package source: "CRAN", "GitHub", or "Bioconductor".

auto_install

Logical. If TRUE (default), install missing packages automatically.

...

Additional arguments passed to inst_pkg().

Examples

Run this code
# Check if ggplot2 is installed (will install if missing):
check_pkg("ggplot2", source = "CRAN")

# Check without auto-install:
check_pkg("r-lib/devtools", source = "GitHub", auto_install = FALSE)

Run the code above in your browser using DataLab