Skip to Main Content
Go to Penn Libraries homepage   Go to Guides homepage

R for Business Guide

Install R and RStudio

The typical R setup requires installing two pieces of software: R and RStudio.

 

  1. Start from Posit’s RStudio Desktop download page.
  2. Use the Download and Install R button.
    1. Choose the link for your operating system.
    2. Choose base.
    3. Download using the top link.
  3. Install R using the file you downloaded; let the process confirm it finished.
  4. Go back to the RStudio download page.
  5. Use the Download RStudio Desktop button.
    (The browser should have selected the right version for your machine, but you can scroll down for more options.)
  6. Install RStudio using the file you downloaded; let the process confirm it finished.

You can confirm R and RStudio are working by running the installed RStudio application.

Install R packages

You can expand R's capabilities by installing packages. It's common to get them from the CRAN package repository.

  1. Open an R session. (Use RStudio, base R, or whatever environment you use for R.)
  2. Place your cursor in the Console. (In RStudio, this is the lower left pane by default.)
  3. Type install.packages("package_name"), e.g.:
    install.packages("ggplot2")
  4. Press Enter to run the line.
  5. In some cases, you will see messages about download and installation. If you are prompted for a response, read the prompt and enter your response. When an empty new line (> followed by white space) appears in the Console, installation has finished.

Consider getting important package names from your instructors or from academic papers. You will need to know and type the name of your package precisely as it appears in CRAN.

You also can confirm whether a package is installed:

  1. Place your cursor in the Console.
  2. Type "package_name" %in% installed.packages(), e.g.:
    "ggplot2" %in% installed.packages()
  3. Press Enter to run the line.
  4. If the package is installed, you'll get the result TRUE. If not, you'll get the result FALSE.

Business & Data Analysis Librarian

Profile Photo
Kevin Thomas
He/Him/His
Subjects: Statistics

Chat

Penn Libraries Home Search the Catalog
(215) 898-7555