Supplementary

This lesson will cover how to install a package manager and a package locally. Our focus from the beginning has been to get you exposed and learning right away about data science. We didn't want to bog anyone down or lose motivation as they tried to set up their own programming environment and run into some difficulty along the way. This is because installing an environment requires knowledge outside the scope of our course, such as what Unix is and how to use a terminal. As such we've left this lesson until the end and made it optional for those that feel comfortable doing this on their own.

Recall in the Interpretation lesson that we learned R is a programming language that allows us to convert text such as print("Hello World") into the zeros and ones that a computer understands. So to write R code all we really need is any text editor, however we need some interface to run R programs. This can be done in any terminal window that comes installed on your computer, called Terminal in Mac and Windows Command Line for Windows, however there are other programs that make the interface easier, two of these are RStudio and VS-Code.

RStudio

Let's go over RStudio first. RStudio is a popular desktop development application that makes coding in R more friendly by in addition to having a text file (called a script) and a terminal to run the code, also adds in the Graphical User Interface (GUI) a way to view data, plots, and ease of working with multiple scripts at once.

Next let's go over how to install R and RStudio locally on your Mac or PC.

Install R on Mac

  1. First, go to this link
  2. Click on: Download R for macOS
  3. There will be a few paragraphs at the top. Click on the link around the middle of the page that looks something like R-4.2.3-arm64.pkg for Macs with an M1 and higher chips and R-4.2.3.pkg
  4. Click the downloaded file and follow the installation steps as you would any other program. Finally, it should ask you to move R into your Applications folder

Install RStudio on Mac

  1. First, go to this link
  2. Second, click the Download button under the 2. Install RStudio column. This site is quite smart and should have prepared for you the correct version for your operating system.
  3. Third, after downloading the file, run the .dmg file and open RStudio. Since we already installed R, RStudio should recognize R is installed.

Install R on Windows

  1. First, go to this link
  2. Click on: Download R for Windows
  3. Click the link that says install R for the first time.
  4. Click the link that says "Download R-4.2.3 for Windows"
  5. Click the downloaded file and follow the installation steps as you would any other program.

Install RStudio on Windows

  1. First, go to this link
  2. Second, click the Download button under the 2. Install RStudio column. This site is quite smart and should have prepared for you the correct version for your operating system.
  3. Third, after downloading the file, run the .exe file and open RStudio. Since we already installed R, RStudio should recognize R is installed.

Install Visual Studio Code on Mac

  1. First, go to this link
  2. Click the button that says Download Mac Universal
  3. Click the downloaded file and follow the instructions to complete the installation as any other program, then open VS-Code from your Applications folder
  4. In VS-Code type Cmd + J or on the top right of the screen there are four buttons with various shaded in portions of boxes, click the second from the left, this will open a terminal
  5. Now you can type R in the terminal and it starts R, if VS-Code does not notice your installation of R, try restarting VS-Code, follow VS-Code's guid here or reach out to us on Discord

Install Visual Studio Code on Windows

  1. First, go to this link
  2. Click the button that says Download Windows
  3. Click the downloaded file and follow the instructions to complete the installation as any other program, then open VS-Code
  4. In VS-Code type Ctl + J or on the top right of the screen there are four buttons with various shaded in portions of boxes, click the second from the left, this will open a terminal
  5. Now you can type R in the terminal and it starts R, if VS-Code does not notice your installation of R, try restarting VS-Code, follow VS-Code's guid here or reach out to us on Discord