Getting started with R and RStudio

If you have any problem with the following instructions please email me. Your problems can also be somebody else's problems!

Why should I bother learning R?

If you already know why you want to learn R (or you just blindly trust us), you might want to skip this section and start installing R.

R is a programming language dedicated to statistical analysis and graphics. As all programming languages is hard since must be understood unambiguously by a machine (as well as by the human being writing it). This means, that if you start today to learn it and if you have no other experience with other computer languages, it will take some effort to get the first results.

So, why you might want to invest time and effort in it?

The short answer is data. If you are working in the humanities or social sciences, the number of big datasets that are increasingly becoming available (either because old information is digitised or because new information is directly produced in a digital format) is clearly increasing. Tools such wordprocessors or spreadsheets are usually unfit to tap into big datasets because even if you manage to open your file they lack sophisticated functions to process the data.

What R offers you is exactly this: a sophisticated library of functions to manipulate, analyse, and visualise your data. A free and open library: everybody can use it, everybody can contribute to it. And indeed, a lot of researchers have already contributed to the library. For examples, have a look at these two pages listing the most relevant R packages developed for the social sciences and for text analysis.

OK, but what about RStudio?

If R is the engine, RStudio is the user-friendly interface. RStudio is not necessary to use R but it helps especially if you want to use R interactively - that is, do something and immediately see the results. In RStudio you have a panel for your code (a text editor), a panel for the R console (where you tell R what do and where you get textual output), a panel with all the stuff loaded in memory by R, and an extra panel where you'll see plots, where you can access the file on your computer and where you can navigate the help pages from the R packages.

run-button

Install R

For Windows

If you have a Windows computer, you need to download and install this file.

For Mac OS X

If you have a Mac, you need first to understand which version of OS X you have. You should be able to get it by clicking the Apple logo in the top-left corner of your screen and then on About This Mac.

about-this-mac

For Linux

If you are running Linux, I'm sure you don't need any instructions.

Install RStudio Desktop

RStudio requires R. Before proceeding you need to make sure you have R installed (as explained in the previous section)

For Windows

If you have a Windows computer, you need to download and install this file.

For Mac OS X

If you have a Mac, you need to download and install this file.

Getting started with R and RStudio

If you have successfully installed R and RStudio, have a look at this two video for a short introduction to R and RStudio. At the end you should be able to

and be more or less familiar with the interface of RStudio

Getting started with R and RStudio

Introduction to R Programming: Getting Started With R (R Tutorial 1.1)

You might also want to read Chapter 2 from Humanities Data in R.

Getting out of trouble

A great way of getting out of trouble is posting a question on the Q&A website http://stackoverflow.com/. You can post a question right now here. But before you do it, you might want to read this: How do I ask a good question?.

Resources