Learn R Programming

evanverse (version 0.3.7)

inst_pkg: Install R Packages from Multiple Sources

Description

A unified installer for R packages from CRAN, GitHub, Bioconductor, or local source.

Usage

inst_pkg(
  pkg = NULL,
  source = c("CRAN", "GitHub", "Bioconductor", "Local"),
  path = NULL,
  ...
)

Value

NULL (invisibly)

Arguments

pkg

Package name(s) or GitHub repo (e.g., "user/repo"). Not required for source = "local".

source

Source of package: "CRAN", "GitHub", "Bioconductor", "local". Case-insensitive, shorthand allowed.

path

Path to local package file (used when source = "local").

...

Additional arguments passed to install.packages(), devtools::install_github(), or BiocManager::install().

Examples

Run this code
if (FALSE) {
# Install from CRAN:
inst_pkg("dplyr", source = "CRAN")

# Install from GitHub:
inst_pkg("hadley/emo", source = "GitHub")

# Install from Bioconductor:
inst_pkg("scRNAseq", source = "Bioconductor")

# Install from local file:
inst_pkg(source = "local", path = "mypackage.tar.gz")
}

# \donttest{
# Quick demo - try to install a small package (will skip if already installed):
try(inst_pkg("praise", source = "CRAN"))
# }

Run the code above in your browser using DataLab