Skip to Main Content
It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.
The HSHSL is a part of the University of Maryland, Baltimore | My UMB The Elm UM Shuttle Blackboard
Library Logo

601 West Lombard Street
Baltimore MD 21201-1512

Reference: 410-706-7996
Circulation: 410-706-7928

R: Installing R and R Packages

An introduction to the R programming language.

Installing R and R Packages

Install R

R is freely available for Linux, Mac, and Windows operating systems.

To install R,

  1. Click the "Install R" button below.
  2. Select the appropriate download for your operating system.
  3. Follow the provided install instructions.

Install R

 

Install RStudio

RStudio is an "integrated development environment" that many people find useful for using R. It is essentially a graphical user interface layer over R's default command line interface. Also, while there are differences in the way R works across different operating systems, RStudio provides the same experience on all platforms. RStudio is also free and open source.

*NOTE: R should be installed before RStudio.

To install RStudio,

  1. Install R (see above).
  2. Click the Install RStudio button below.
  3. Select the appropriate download based on your operating system.
  4. Follow the provided install instructions.

Install RStudio .

 

Install R Packages

"Packages" are libraries of code that provide R functions, data, and documentation. R comes with "base R", a collection of standard packages. You can view the base R packages after installing R by running the following code in the command line interface.

library()

Most R packages are available from CRAN website. Many packages can also be found on GitHub.

There are multiple ways to install R packages:

Command line

Type the following command, where <pkg name> is the name of the package to be installed.

install.packages("<pkg name>")

 

From RStudio "Tools" menu

  1. Click on the "Tools" menu in RStudio.
  2. Select "Install Packages".
  3. Enter the package name to be installed.

 

From RStudio "Packages" tab

  1. Select the "Packages" tab in the lower right window of RStudio.
  2. Click the "Install" button.
  3. Enter the package name to be installed.