R

R is a programming language and a free software environment to write and execute the R language. The latest version of this free R software environment can be downloaded here (mirror: here). Select the closest mirror. If you are not sure, select 0-Cloud. Then you will need to select the operating system of your computer whether it is Linux, Mac or Windows.

The basic R environment looks like this. Getting Started with R and RStudio - 1 R Console

The console window is where you type and submit your R commands. The results of your code will also appear in this window. Entered commands appear in red and the results of your commands will appear blue.

Instead of typing your code in the console window, you can also enter your code in the R script window. To open a new script window, go the File menu and select New Script. For clarity, you can organize these windows by going to the Windows menu and selecting either Tile Horizontally or Tile Vertically.

Getting Started with R and RStudio - 2 R Console and Script

Your screen should look like this, with your script editor on one side and the console on the other. Now, you are ready to begin using R!

EXECUTING CODE

R is a code-based program (you have to type what you want it to do rather than clicking buttons).  You can type your code in the console window or in the R script window. If you are writing your code directly in the console window, hit enter to submit and run the code.

There are two options to run a line of code from the R script window:

  1. Use the shortcut Ctrl + R
  2. Go to the Edit menu and click on Execute (the button is greyed out if you are in the console window).

To run multiple lines of code, select the lines of code and use one of the options above.

Tool: R


First created: July 03, 2020
Last updated: May 27, 2026

Tutorial maintained by Nadia Muhe.

Tutorial created by Nadia Muhe.

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International icon