R and RStudio

To install R and RStudio, you must have administrator privileges on your machine. Choose the version appropriate for your operating system. You can also watch a video for a Mac or a Windows install (you only need to install R and RStudio, and none of the other programs mentioned in the videos). Please also note that the versions of R and RStudio in the video are older. Instead, install or update to the latest version supported by your operating system.

Install R

  1. Go to https://cran.r-project.org/

  2. Choose among “Download and Install R” section (not “Source Code for all Platforms”).

    Latest version: 4.1.2

    (only for macOS Yosemite or older: legacy version 3.3.3)

Note for Mac users

If you have an M1 (and higher) Mac, you must install the Intel version of R (Bioconductor packages installed below are not yet compatible with the arm64 version).

Note for all users

You must have R installed before proceeding to the next step.

Install RStudio

  1. Go to https://rstudio.com/products/rstudio/download/#download

  2. Select the FREE Desktop version.

  3. Choose among “Installers for Supported Platforms” section (not “Zip/Tarballs”) or follow the link to older versions of RStudio if you need a legacy version.

    Latest version: 2021.09.0

    (only for macOS El Capitan and older: legacy version 1.1.463)

Install R packages

Open RStudio, then:

  1. Select the “Console” tab of the left panel .
  2. Copy the following code after the prompt > to install all necessary packages:

    if (!require(tidyverse))    install.packages("tidyverse")
    if (!require(pheatmap))     install.packages("pheatmap")
    if (!require(RColorBrewer)) install.packages("RColorBrewer")
    if (!require(BiocManager))  install.packages("BiocManager")
    if (!require(DESeq2))       BiocManager::install("DESeq2")
    if (!require(plyranges))    BiocManager::install("plyranges")

    While installing (or updating, see below) packages, you might be prompted:

      There is a binary version available, but the source version is later:
    
    <table of package names>
    
    Do you want to install from sources the package which need compilation? (Yes/no/cancel)

    Always enter no followed by enter.

  3. Update packages by selecting the “Packages” tab of the bottom right panel and then click on “Update” .

  4. If any packages are listed, first click on “Select All” and then “Install Updates” .

Check that it worked

After you open RStudio, it should look like the screenshot below with the left panel (the “console”) listing the most current R version for your operating system .

Troubleshooting

RStudio looks incorrect

If you only see a single panel instead of 3 like in the example image, you likely opened base R instead of RStudio. Look for the RStudio logo to open the correct program.

If you confirmed RStudio is open but don’t see the same panels as depicted above, then in the RStudio menu bar, select View > Panes > Show all panes.

My computer won’t let me open the downloaded files to install them

Mac: right-click and choose “Open With” > “Installer.app (default)” and select “Open” when prompted if you are sure you want to open the file

Windows: right-click and choose “Run as administrator”

Still doesn’t work

Please come to one of the office hours to get help.