π Getting Ready
2024/25 Autumn Term
On this page, you will find information on how to set up your computer for this course, as well as practical advice on R programming.
1. Set up your computer
Below you will find links to download and install the software that you will need for this course. If you prefer a more detailed guide, you can follow this guide created by our colleague Andrew Moles from the LSE Digital Skills Lab.
LSE Digital Skills Labs are also offering in-person workshops at the start of autumn term. We highly recommend you take these workshops if you are new to R programming.
1.1 Install R
R is a programming language and software environment created primarily for statistical computing. It is free and open-source and runs on Windows, Mac OS X, and Linux.
π Link: Download R from the Comprehensive R Archive Network (CRAN). Choose the download link that is appropriate for your operating system.
1.2 Install an IDE
Once you download R, you can start using it straight away. All you need to do is type R
(or R.exe
if you are on Windows) in your terminal to start the R interpreter. You can also write your R scripts in any text editor and run them from the terminal with the Rscript
command. However, it is much more convenient to use an integrated development environment (IDE) that provides a graphical user interface (GUI) to R.
In this course, we will leave it up to you to choose the IDE that you prefer. If you are new to all of this, stick with RStudio β this is what most R programmers use. If you are already familiar with Visual Studio Code, you can use it for R programming as well. Follow the instructions below for the IDE of your choice.
The most common IDE used by R programmers is RStudio, which is available for free. It comes with a console and syntax-highlighting editor that supports direct code execution, as well as tools for plotting, history, debugging and workspace management. It is definitely the easiest way to get started with R.
π Link: Download RStudio Desktop from the RStudio website.
If you are already familiar with Visual Studio Code, say because you have already used it for Python, you can also use it for R programming. You will need to do a bit of configuration to get it to work, but it is not too difficult.
Why would you want to use VS Code instead of RStudio? Well, VS Code is a general-purpose IDE that supports many programming languages and it is very customizable. If you are already familiar with it, you may prefer to use it for R programming as well. Also, VS Code is a bit lighter than RStudio, so it may be a better choice if you have an older computer.
Another reason is that there is a GitHub Copilot extension for VS Code, which is an π€ AI-powered tool that helps you write code.
π Link: Download the R Extension for Visual Studio Code and remember to follow the instructions on the Getting Started section of the extension page.
2. Learn R
This course relies a lot on R programming. You should practice your R programming skills, especially before the second lab (Week 02) of this course. Here are several ways to do that.
2.1 Take the in-person pre-sessional workshops
Our colleagues at the LSE Digital Skills Lab have put together a great programme of workshops to help students prepare for courses that require R programming. The courses are free and open to all LSE students and are perfect if you are new to programming in R, or you need a refresher.
π Link: Find out more about the LSE Digital Skills Lab
2.1 Take the self-paced Dataquest course
If you prefer to learn R at your own pace, you can take the Dataquest course pre-selected by our colleagues at the Digital Skills Lab.
As a student at LSE, you can get a free Dataquest subscription but you need to request a premium license first! To do so, please follow the instructions on the Getting access and using Dataquest section of the Moodle page for this course. Our colleagues at the Digital Skills Lab will respond to you as soon as possible.
2.2 R for Data Science book
Perhaps one the best ways to learn R on your own is to read the book R for Data Science 2nd edition by Hadley Wickham, Mine Γetinkaya-Rundel, and Garrett Grolemund. It is available for free online.
More specifically, you can read it in the following order:
Whole game
- Chapter 1 - Introduction
- Chapter 3 - Workflow: basics
- Chapter 7 - Workflow: scripts and projects
- Chapter 8 - Data import
Transform
- Chapter 13 - Logical vectors
- Chapter 14 - Numbers
- Chapter 15 - Strings
- Chapter 17 - Factors
Program
- Chapter 26 - Functions
- Chapter 27 - Iteration
- Chapter 28 - A field guide to base R