library(learnr)
tutorial_options(exercise.timelimit = 10, exercise.blanks = "___+")

Introduction

This guide will help you get set up for the R BootCamp. There are just a few steps to make sure you'll have the necessary software installed and ready to go on day 1. Please ensure that you've completed each step by running the validation test at least 1 week prior to the start of BootCamp.

This guide will walk you through how to install R, RStudio, and some additional tools that we’ll be using in the course. By rough analogy to a car, R is like the car’s engine and RStudio is like the dashboard. More precisely, R is a programming language and Rstudio is an ‘integrated development environment’ (IDE), which is basically a nice software interface for interacting with R. For our purposes, you will only ever interact directly with RStudio, but it needs to have R installed to work (like a car needing its engine).

Please complete the following steps (must be done in this order). If you already have R and Rstudio installed you can skip ahead. Make sure you complete step 5 though!

  1. Install R
  2. Install RStudio
  3. Check you have recent versions of R
  4. Install required packages
  5. Run verification test

Please consult the links provided for additional tips, and feel free to reach out to us for help at aborah@broadinstitute.org if you get stuck.

Install R

Please watch this quick video guide on how to install R, and then use the link below.

NOTE MacOS users: With the new MacOS updates, updating R might require you to re-install your packages. While not in issue for many people, you have been warned https://cloud.r-project.org/

Install RStudio

Please watch this quick video on how to install Rstudio, and then use the link below. https://www.rstudio.com/products/rstudio/download/

Install Required Packages

Many of the tools we’ll want to use don’t come prepackaged with R, but rather need to be installed in ‘packages’. There are a few key packages we’ll be using. Watch the following video on how to install packages in Rstudio: You can also refer to this site for more info on what packages are and how to install them (including a ‘GUI’ installation method if you prefer that). Please install the tidyverse R package, which we’ll be relying on extensively throughout the course. No need to worry about what exactly this is yet, but you can read more here if you like.

Run verification test

Now it’s time to make sure you have everything installed properly! First, open Rstudio (remember, you want to open Rstudio, not R). You should see a window that looks something like this:

The pane with the ‘>’ symbol is the Console. This is where you enter R commands. Copy and paste the following code into your Rstudio console and hit return.

R_version <- as.numeric(R.version['major']$major)
if (R_version >= 4) {
    library(ggplot2)
    ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, color=Species)) + 
        geom_point()
} else {
    print('R version is too old')
}

You should see a plot that looks like this appear:

If you see an error that says “R version is too old” that means you need to update your R version. The update process is the same as the installation process. It will update your R installation. If you see an error that says “There is no package called ggplot2” that means you need to install the tidyverse package (see above).



AshirBorah/cp_bootcamp_r_tutorials documentation built on May 16, 2024, 3:24 p.m.