Getting Started with R


What is this course for?

This course will go through the basics of downloading and using R.

What is R?

R is a programming language and free software you can use for analysing statistics.

It can be difficult to learn at first. It has a steep learning curve:

steep curve

But if you keep at it, you’ll find it’s a great bit of software. It’s faster, cheaper and more versatile than most of the alternatives. You can use it for data analysis, for producing graphs, and pretty much anything else you might want to try. Even this website was made using an R package called Blogdown.

Perhaps the best thing about R compared to the spreadsheet-style stats software (SPSS or Excel) is that it’s all reproducible.

If you wanted to make the graph above, for example, I’ll show you how:

x <- (1:10000)
y <- x^4
plot(x, y, type = "l", col = "blue", xlab="Hours spent learning",
     ylab="Proficiency", xaxt="n", yaxt="n")
title("Learning R")

steep curve

Copy and paste that into R and you’ll get exactly the same result. There’s no chance you’ll click the wrong options and no long-winded tutorials. I once spent 45 minutes on the phone to a friend of mine gong through how to make a plot as simple as the one above in SPSS. In R it would have taken 30 seconds.

What is R Studio?

RStudio is another piece of free software which is designed to make R easier to use. It might help to just have a look at the difference.

The user interface for R:

R_interface

And the user interface for RStudio:

R_studio_interface

R studio gives you much more information on the screen at once. We’ll have a look at each of the panes does later on. For now, it’s worth knowing that Rstudio makes using R much more intuitive and is highly recommended. There are no reasons I can think of that you’d be better off using base R, especially if you are using Windows or a Mac and if you are learning to code for the first time.

It’s also worth pointing out that you cannot use RStudio without first downloading R. Instructions will be added soon.