Getting going in R and RStudio


This is an interactive tutorial and was created by Dr. Mark Greenwood () based on the source code that was originally created by RStudio.


This tutorial will help you set up your computer to use R. It is for you if you need to:

  • Install R on your computer
  • Install the RStudio IDE
  • Install the tidyverse R package

You can skip this tutorial if you’ve already done these things in the last month. See notes below that discuss suggested updates to R and RStudio.

Is this tutorial for you?

Do you need to work through the tutorial? Take the quiz below to find out.

Install R

How to install R

Test your knowledge

The video was recorded with a previous version of R (3.3.2). Before moving to the next step, complete the installation on R. It is important to note that if you have previously installed R, you should complete the same steps to get an updated version of R.

Quiz - Install R

Install RStudio

How to install RStudio

RStudio is an Integrated Development Environment for R. What does that mean? Well, if you think of R as a language, which it is, you can think of RStudio as a program that helps you write and work in the language. RStudio makes programming in R much easier and I suggest that you use it!

Test your knowledge

Quiz - Install RStudio

With R and RStudio installed, you are now ready to start writing code that will allow you to load data sets and perform statistical analysis.

Using R


It is good to start with trying out the console to do some quick code work and for things like using it as a calculator. You can see further discussion of this in Chapter 1 of Greenwood (2020).

R Markdown

Eventually, you will want to move to using reproducible research methods via R Markdown. R Markdown provides an authoring framework for data wrangling and statistical analysis. A single R Markdown file can be used to save and execute code and generate high quality reports that are fully reproducible. You can go to RStudio’s website for a complete tutorial.

That tutorial starts with this video that discusses some of what you can do with R Markdown:

We will discuss using R Markdown more in the workshop, but hopefully this gets you excited about learning to use it!

Install Packages

How to install R packages

Test your knowledge

Quiz - Working with Packages

Wrap up (and a backup option)

Once you have completed these steps, you should be ready for the “Introduction to R” Workshop. If you had any difficulties with getting your computer set up for the workshop, please contact the workshop organizers in advance. We can either diagnose the issue via email or we can set up a time to chat and hopefully resolve the issue.

You can also borrow a laptop from the MSU library (or maybe from a good friend) for the workshop. It needs to be a computer that is running Linux, Windows, or a somewhat recent macOS. Unfortunately, a chromebook or ipad are not sufficient for installing and running R.

One way or another, you should be set up and ready to harness the amazing capabilities of R via RStudio. Thanks for taking the time to prepare for your first steps in learning to use R.

If you already have experience using R and RStudio and the tidyverse, the “Introduction to R” workshop may not be the best starting point for you in the R Workshops series. Feel free to email the workshop organizers if you have had some practice using RStudio in courses or other activities to discuss this. The “Introduction to R” is a very introductory workshop and more advanced workshops will follow.

See you soon!