1 Introduction

Statistics helps us to analyse data. To begin, we need to learn how to access data and how to have a very first look at it. This lab will be about just that. You will learn the basics of using RStudio, opening data files in different formats, and how to look at objects in the R environment.

Through this file, all code you need will be provided, but at the end you will get a series of questions to answer. You can edit this file and add the relevant commands where appropriate. On the course website, there is a link to a video about RMarkdown that might be very useful.

As a first exercise, we will open a file with data from a survey taken from members of the British electorate around the time of the Brexit referendum. We can look at how remain voters differed from leave voters, or whether older or younger voters are more likely to be pro-Europe. We will use the same data set next week to delve deeper into descriptive statistics.

Occasionally you will find references to additional online material, in particular one online textbook on the use of modern techniques, R for Data Science.

1.1 RStudio

The statistical package we use in this course is R, which is increasingly popular in statistics, data science, and applied disciplines such as political science. Because R is nothing more than a program that interprets commands and produces output, it is much easier to use with a dedicated user interface. RStudio provides this interface to R and a screenshot of RStudio is below.