Installing R and RStudio®

Tim Newbold

2021-10-08

Overview

In this session, I will show you how to install and get started with the R and RStudio®1 software.

R

The underlying software that runs your code is R.

You can find instructions for installing R here.

When you have installed R and you run the software, you will see a window like this:

R Console Window

This allows you to enter and run code, similar to what you have been doing already on the website we have been using. Try having a go.

RStudio®

RStudio® provides a friendlier environment in which to write, edit and run code, and to see your results.

Installation instructions can be found here. Make sure you install the free Desktop version!

Once you have installed and loaded RStudio®, you will see something like this:

RStudio® Window

The left-hand panel is where you can enter and run code directly. If you click File → New File → R Script, you will get another panel:

RStudio® window with script window

Now you can draft code in the top-left panel and save it to file. This keeps a record of all of your code. You can then run all of this code by clicking ‘Source’, or individual lines by clicking ‘Run’. Have a go at writing a few commands of your own and running them.

By default, the top-right panel lists all the variables currently in your working environment:

RStudio® environment window

We will come back to the other options for the panels in later sessions.

For now, just have a play around and get familiar with R and RStudio®.

Next Time

In the next session, I will cover inputting and outputting data.

Footnotes


  1. RStudio® is a trademark of RStudio, Inc.↩︎