Appendix A — Package management

Reference material for managing packages, followed by background on R and its installation tools. For the basics, start with Install & Update R Packages.

A.1 Introduction

This appendix covers package management beyond the basics. Packages are fundamental to R. More than 22,000 packages are available on CRAN, the Comprehensive R Archive Network (as of September 2026; verify the current count at cran.r-project.org/web/packages).

Packages are available for different topics. You should always look for a package before writing code from scratch. If you have written your own code for a new analysis or topic, do share it with the R community by converting it into a package. You can learn more about building R packages from R Packages, a book by Hadley Wickham.

A.2 Other package sources

A.2.1 GitHub

Some developers make R packages available on GitHub before releasing them on CRAN. We can install such packages using install_github() from the devtools or remotes package. You need to specify the name of the repository and the package. For example, we can download ggplot2 or dplyr with this code:

devtools::install_github("tidyverse/ggplot2")
remotes::install_github("tidyverse/dplyr")

A.2.2 Bioconductor

Bioconductor provides tools for analysis and comprehension of high throughput genomic data. Install the BiocManager package and use BiocManager::install():

# install BiocManager if needed
install.packages("BiocManager")

# install a Bioconductor package
BiocManager::install("GenomicFeatures")

For faster installs with dependency resolution, you can also try pak::pkg_install() from the pak package as a modern alternative.

A.3 Install Different Versions

Now that we have learned how to install packages, let us look at installing different versions of the same package.

remotes::install_version('dplyr', version = "0.5.0")

If you want to install the latest release from GitHub, append @*release to the repository name. For example, to install the latest release of dplyr:

remotes::install_github('tidyverse/dplyr@*release')

A.4 Installed Packages

  • installed.packages(): view currently installed packages
  • autoload('function_name', 'package_name'): load functions and data from packages only when called in the script
  • available.packages(): packages available for installation
  • old.packages(): packages which have new versions available
  • new.packages(): packages not yet installed
  • remove.packages('package_name'): remove installed packages

A.5 Library Paths

A library is a directory that contains installed packages. Your system will usually have more than one R library. You can locate the libraries using .libPaths().

.libPaths()
[1] "/home/runner/.cache/R/renv/library/intro-r-eca02dad/linux-ubuntu-noble/R-4.5/x86_64-pc-linux-gnu"
[2] "/home/runner/.cache/R/renv/sandbox/linux-ubuntu-noble/R-4.5/x86_64-pc-linux-gnu/46e831e3"        

Use lib to install or remove packages in a particular library, and lib.loc to load or update them.

A.5.1 Install

install.packages('stringr', lib = .libPaths()[1])

A.5.2 Load

library(lubridate, lib.loc = .libPaths()[1])

A.5.3 Update Packages

update.packages(lib.loc = .libPaths()[1])

A.5.4 Remove Packages

remove.packages('stringr', lib = .libPaths()[1])

Explore Rsquared Academy’s own R packages and guides at pkgs.rsquaredacademy.com.

A.6 R background and installation tools

The rest of this appendix gives background on the organizations behind R and the tools used to install it.

A.7 Organizations

A.7.1 R Foundation

The R Foundation is a not-for-profit organization founded by members of the R core team. It is responsible for the continued development of R. It also supports the annual useR conferences. You can learn more about the R Foundation here.

A.7.2 R Consortium

The R Consortium supports the R Foundation and other key organizations and groups developing, maintaining and using R. It funds projects that improve the infrastructure around R and supports conferences and user groups around the world. You can learn more about the R Consortium here.

A.8 Installation

R is available for Windows, Mac and is part of many Linux distributions. You can download and install R from any of the CRAN mirrors listed here.

A.8.1 CRAN

CRAN stands for Comprehensive R Archive Network. You can download R and user contributed packages from here for different operating systems. CRAN is pronounced as KRAN or C-RAN.

A.8.2 Extensions

User contributed packages can be downloaded from

A.8.3 R GUI

R comes with a simple GUI with sufficient features for data analysis and visualization.

Screenshot of the base R GUI window