Package Management

Last updated: September 29, 2019

Package management

Packrat is the standard package management tool for R. It’s not perfect, but it’s better than nothing.

Possible alternatives include pak (a R Infrastructure package that is an alternative to install.packages() and devtools::install_github()) and renv (from RStudio).

Standard workflow

Storing installed packages in a custom library location

.libPaths(c("/path/to/folder", .libPaths()))

After you run that, install.packages() will install in that folder, and library() will try to load from that folder.

Installing a specific version of a package

Using the remotes package

remotes::install_github("user/repo@v1.1.1")

Using the devtools package

devtools::install_version()

ℹ️ This page is part of my R knowledge base, which attempts to use idiomatic practices with the tidyverse collection of packages as much as possible. If you have suggestions for ways to improve this code, please contact me.