Prerequisites and starting up

The prerequisites in R for Data Science are the same for this guide:

  1. Install R for Windows, Mac, or your variant of Linux.
  2. Install RStudio.
  3. Run RStudio, and install the tidyverse by typing the following into the RStudio console: install.packages("tidyverse")

Check out the section on errors if you run into any problems installing the tidyverse.

Run Rstudio

Whenever people talk about using R, they usually are referring to RStudio or a similar IDE. Don’t bother with the weird GUI that comes with R.

Working in a saveable file

Writing code directly in the console gets annoying really quickly. So make a new R file for your code.

In RStudio, go to File -> New File -> R Script

You can now type and edit code in the file. To run a line, select it and press Ctrl+enter (PC) or cmd+enter (Mac).

Try copying this code into the file (not the console) and running it:

2 + 3
#> [1] 5