Getting going in R and RStudio

Welcome

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

Outline

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

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 via RStudio

Console

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 (2021).

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:

Back up option to access R via RStudio Server (MSU Students only):

If you are having any difficulties getting your local installation of R and RStudio to work (you may not discover this until you try to use it to complete tasks), there is one other option for you to be able to use R via RStudio via a web-browser.