How to install a library in R?

Libraries: a set of functions for specific uses

R is provided with a set of basic functions, mainly dedicated to statistics processing and data science. However, as it develops, the language was used for various usages that bring the community to create their own libraries.

These libraries, also named packages, are a set of functions, regrouped for a specific use: dataset processing, character string processing…

Install a R library

To install a R library, go to the R console and launch the function install.packages()

For example, if you want to install the DPLYR library:


The function install.packages() must be launched on the RStudio console.

Your package is now installed.

Note that the function install.packages() will install your packages from the CRAN repository.

It's possible to install other libraries from Github thanks to the function install_github(),

available with the devtools package.