Census microdata activity - R code
Introduction
Welcome to the census microdata activity - R code. This page provides the R code used in the module activity.
What you will find in this page
- An introduction to the census microdata activity
- A chapter containing the full R code used for analysis
Requirements
To use the code in this page, you will need:
- R and RStudio installed on your computer
- The required R packages installed
- Download the teaching dataset: 2021 census microdata open access, England and Wales
Data access and file location
In this code, the dataset is referenced using the following relative path: data/publicmicrodatateachingsample.sav
Please, update this file path in your code accordingly so that R can locate the dataset file on your computer.
How to use this page
Navigate to Chapter 1 to view the complete R script. At this stage, the code is displayed for reference and can be copied but does not run within the page.