Setting Up R#

By YAP and YDAWG members.

This document will help you to get ready with R. Original version as a Word document can be found here.

Step 1 – Install base R#

Windows#

image.png

  • Run the installer

image.png

MacOS#

image.png

  • Run the installer

image.png

Step 2 – Install RStudio#

RStudio is an open source development environment for R. It adds functionality to make R coding easier and faster.

image.png

  • Install RStudio (Windows)

image.png

  • Install Rstudio (MacOS) image.png

Step 3 – Setup package installation location#

  • Open RStudio

image.png

Packages are additional functions and tools that extend R’s functionality. They are critical to making full use of R and RStudio.

Step 4 – Install the packages#

You may now run code or commands by typing it into editor and using Ctrl+Enter to run, or directly into the R console and pressing Enter.

  • The install.packages command will download and install R packages

  • Packages that require other packages will install all dependencies at once

  • Run install.packages(<<package name>>) for each of the packages listed above → This will download and install the packages into your library

  • Finally, run the library(<<package name>>) command to load the library into your R session

You can use the sessionInfo() command to list out the packages your R session has attached.