Analysing social survey data using R

Author

Pierre Walthéry, Nadia Kennar, Rihab Dahab, UK Data Service

Published

June 1, 2024

Introduction

This guide provides an introduction to analysing large scale social survey data using R, with examples from the British Social Attitudes Survey 2017. It is aimed at two categories of users: 

  1. Those inside or outside higher education, or who do not have access to commercial statistical software such as Stata, SPSS or SAS but who would like to conduct their own analysis beyond what is usually published by data producers: for example statistics for specific groups of the population. This guide provides this group of users with a range of procedures that will help them produce straightforward and robust analyses tailored to their needs without spending unnecessary time on learning the inner workings of R. 

  2. More advanced users who are already familiar with other data analysis tools but who would like to learn how to carry out their analyses in R.

A wealth of introductory content on R programming is already available online. The guide therefore focuses on providing succinct examples of common operations that most users of social surveys carry out in the course of their research, including how to:

  • read in and open datasets.
  • do common data manipulation operations.
  • produce simple descriptive statistics or tabulations.
  • handle survey weights and survey design variables