ghit (version 0.2.18)

install_github: Install R package from GitHub

Description

install_github allows users to install R packages hosted on GitHub without needing to install or load the heavy dependencies required by devtools. ghit provides a drop-in replacement that provides (almost) identical functionality to devtools::install_github().

Usage

install_github(repo, host = "github.com", credentials = NULL,
  build_args = NULL, build_vignettes = TRUE, uninstall = FALSE,
  verbose = FALSE, repos = NULL, type = "source", dependencies = NA,
  ...)

Arguments

repo

A character vector naming one or more GitHub repository containing an R package to install (e.g., “leeper/ghit”), or optionally a branch (“leeper/ghit[dev]”), a reference (“leeper/ghit@b200fb1bd”), tag (“leeper/ghit@v0.2”), or subdirectory (“leeper/ghit/R”). These arguments can be placed in any order and in any combination (e.g., “leeper/ghit[master]@abc123/R”).

host

A character string naming a host, to enable installation of enterprise-hosted GitHub packages.

build_args

A character string used to control the package build, passed to R CMD build.

build_vignettes

A logical specifying whether to build package vignettes, passed to R CMD build. Can be slow. Note: The default is TRUE, unlike in devtools::install_github().

uninstall

A logical specifying whether to uninstall previous installations using remove.packages before attempting install. This is useful for installing an older version of a package than the one currently installed.

verbose

A logical specifying whether to print details of package building and installation.

repos

A character vector specifying one or more URLs for CRAN-like repositories from which package dependencies might be installed. By default, value is taken from options("repos") or set to the CRAN cloud repository.

type

A character vector passed to the type argument of install.packages.

dependencies

A character vector specifying which dependencies to install (of “Depends”, “Imports”, “Suggests”, etc.). The default, NA, means c("Depends", "Imports", "LinkingTo"). See install.packages for a fuller explanation.

Additional arguments to control installation of package, passed to install.packages.

credentials

An

Value

A named character vector of R package versions installed.

Examples

Run this code

tmp <- file.path(tempdir(), "tmplib")
dir.create(tmp)
# install a single package
install_github("cloudyr/ghit", lib = tmp)

# install multiple packages
install_github(c("cloudyr/ghit", "leeper/crandatapkgs"), lib = tmp)

# cleanup
unlink(tmp, recursive = TRUE)

Run the code above in your browser using DataCamp Workspace