pak (version 0.3.1)

pkg_install: Install a package

Description

Install a package and its dependencies into a single package library.

Usage

pkg_install(
  pkg,
  lib = .libPaths()[[1L]],
  upgrade = FALSE,
  ask = interactive(),
  dependencies = NA
)

Value

(Invisibly) A data frame with information about the installed package(s).

Arguments

pkg

Package names or remote package specifications to install. See pak package sources for details.

lib

Package library to install the packages to. Note that all dependent packages will the be installed here, even if they are already installed in another library.

upgrade

When FALSE, the default, does the minimum amount of work to give you the latest version of pkg. It will only upgrade packages if pkg, or one of its dependencies, explicitly requires a higher version than what you currently have.

When upgrade = TRUE, will do ensure that you have the latest version of pkg and all its dependencies.

ask

Whether to ask for confirmation when installing a different version of a package that is already installed. Installations that only add new packages never require confirmation.

dependencies

Dependency types. See pkgdepends::as_pkg_dependencies() for possible values. Note that changing this argument from the default might result an installation failure, e.g. if you set it to FALSE, packages might not build if their dependencies are not already installed.

See Also

Other package functions: lib_status(), pak_package_sources, pak(), pkg_deps_tree(), pkg_deps(), pkg_download(), pkg_remove(), pkg_status()

Examples

Run this code
if (FALSE) {
pkg_install("dplyr")

# Upgrade dplyr and all its dependencies
pkg_install("dplyr", upgrade = TRUE)

# Install the development version of dplyr
pkg_install("tidyverse/dplyr")

# Switch back to the CRAN version. This will be fast because
# pak will have cached the prior install.
pkg_install("dplyr")
}

Run the code above in your browser using DataLab