Install R and RStudio (2024)

We need to install two things onto your computer. The first is R, this is the programming language we will use. After that we need to install RStudio, this is a front end program that lets you write R code, view plots, and do many other useful things.

If you have a previous installation of R and RStudio, that you have not used much, please remove these first from your computer, and download the current versions as per the instructions below.

Install R

  1. Download the R installer from https://cran.r-project.org/.
  1. Click on the link for your operating system. Make sure the installer is for R version 4.0.0.

Install R and RStudio (1)

  1. Click install R for the first time.

Install R and RStudio (2)

  1. Use the download link at the top and save the file.

Install R and RStudio (3)

  1. Run the installer (double click), default settings are fine. If you do not have admin rights on your laptop, then ask IT. If this is the case, it is important to ask them to give you full permissions to the R directories. Without this you will not be able to install packages. If there is any other problem, we can help you sort it out at the pre-course Zoom checks.

Install RStudio

  1. Wait until the R installer has finished
  2. Download RStudio https://rstudio.com/products/rstudio/download/#download.

Install R and RStudio (4)

The page should recommend the right file based on your system, if not scroll for all the options. If you are having trouble, we can help you sort it out at the pre-course Zoom checks.

Check R and RStudio are working

  1. Open RStudio, it should look like the image below.

  2. We are going to try to run the following code, follow instructions below.

install.packages("ggplot2")library(ggplot2)p <- ggplot(mtcars, aes(wt, mpg))p + geom_point(aes(size = qsec, colour = factor(cyl)))
  1. Copy the code above and paste it in the Console window in R studio, by the > sign, before you hit enter it will look like this.

Install R and RStudio (5)

  1. Hit enter, the code will run, and there will be a plot will be created in the plot window on the right.

Install R and RStudio (6)

If you have a plot similar to mine, all is well, you have installed R and RStudio. You will still need to come to the pre-course Zoom chat just to check your setup, but it will be super quick. If there are any snags, we can chat about it then.

Set up your screen

Setting up your screen well from the start will help get you coding fast, we strongly recommend you try the setups recommended below. The lessons look a lot like RStudio, and it is easy to get confused between your own code and the lesson code. To differentiate the two visually we recommend you change your RStudio theme to something with a dark background.

  1. In RStudio go to Tools > Global Options
  2. Choose ‘Appearance’
  3. Under ‘Editor theme’ chose ‘Idle Fingers’ (or another dark theme)

If you have dual monitors, you’re all set, put RStudio on one and everything else on the other. If you have a single monitor, then you need to be a little more organised.

  1. Put RStudio on the left half of your monitor
  2. Inside RStudio, grab the vertical bar between the Console and the Files/Plot windows and squish it to the right, until you mostly just see the Console.
  3. Put Zoom in the top left corner, taking up about a third of the vertical space. Sometimes I will ask you to go full screen on Zoom, practice going from full screen to top right corner.
  4. Put your browser in the bottom right, taking up the other two thirds of the vertical space.

Install R and RStudio (7)

Author: Gordana Popovic

Last updated: 27 April, 2020

Install R and RStudio (2024)

FAQs

Do you need to download both R and RStudio? ›

Even if you use RStudio, you'll still need to download R to your computer. RStudio helps you use the version of R that lives on your computer, but it doesn't come with a version of R on its own.

What should I install first R or RStudio? ›

To make things simple, we recommend to install first R and then RStudio. R can be downloaded and installed on Windows, MAC OSX and Linux platforms from the Comprehensive R Archive Network (CRAN) webpage (http://cran.r-project.org/).

Can you use RStudio without installing R? ›

R and RStudio are not the same thing. We can run R without RStudio if we need to, but we cannot run RStudio without R. Remember that!

Can I use RStudio instead of R? ›

First time users of R are often confused as to the difference between R and RStudio. RStudio is actually an add-on to R: it takes the R software and adds to it a very user-friendly graphical interface.

What is the difference between R app and RStudio? ›

What's the Difference? R the application is installed on your computer and uses your personal computer resources to process R programming language. RStudio integrates with R as an IDE (Integrated Development Environment) to provide further functionality.

Is R and RStudio free? ›

R and RStudio are free and open-source, and can be installed on any Windows, Mac, or Linux computer that you have appropriate permissions to install software.

Can I install R for free? ›

R is a free software environment for statistical computing and graphics.

Where is the best place to download R? ›

To Install R

Open an internet browser and go to www.r-project.org. Click the "download R" link in the middle of the page under "Getting Started."

Can I run R without downloading? ›

By compiling R to WebAssembly a user can visit a website and run R code directly within the web browser, without R installed on their device or a supporting computational R server. All that is required is a normal web server, including the type of cloud hosting service provided by Github Pages or Netlify.

Why do you need R and RStudio? ›

One of the advantages of using RStudio is that all the information you need to write code is available in a single window. Additionally, with many shortcuts, auto completion, and highlighting for the major file types you use while developing in R, RStudio will make typing easier and less error-prone.

Do I need to install R packages every time? ›

We only need to install a package once on our computer. However, to use the package, we need to load the library every time we start a new R/RStudio environment. You can think of this as installing a bulb versus turning on the light.

Is RStudio essential to run R code? ›

Yes, you can write and execute R code without using R Studio. R is a programming language and software environment for statistical computing and graphics. You can write R code using any text editor or integrated development environment (IDE) of your choice.

How do I get RStudio to use the new version of R? ›

Switching R versions in Windows
  1. In RStudio, goto "Tools" then "Global Options"
  2. Click "Change" next to the "R version" drop down menu and a window will pop out, allowing you to change the R version.
  3. For Mac users, download rswitch to change R version used https://rud.is/rswitch/.

Top Articles
Latest Posts
Article information

Author: Stevie Stamm

Last Updated:

Views: 6312

Rating: 5 / 5 (60 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Stevie Stamm

Birthday: 1996-06-22

Address: Apt. 419 4200 Sipes Estate, East Delmerview, WY 05617

Phone: +342332224300

Job: Future Advertising Analyst

Hobby: Leather crafting, Puzzles, Leather crafting, scrapbook, Urban exploration, Cabaret, Skateboarding

Introduction: My name is Stevie Stamm, I am a colorful, sparkling, splendid, vast, open, hilarious, tender person who loves writing and wants to share my knowledge and understanding with you.