Current Status

Not Enrolled

Price

Free

Get Started

A practical workshop on writing efficient, reproducible and robust R code when working with large administrative datasets in the ONS Secure Research Service. Drawing on real-world SRS experience, the session will cover analytical workflow design, efficient database queries, memory management, safe joins, validation and reproducibility.

Course description

Working with large linked administrative datasets in a secure research environment creates practical and computational challenges that are not always encountered when using R on a local computer. This workshop will introduce good practices for designing, developing and checking R workflows in the ONS Secure Research Service (SRS).

Drawing on practical experience of conducting population-level linked education and health research in the SRS, the session will explore how to define the analytical unit before manipulating data; reduce data before bringing it into R; reduce data as early as possible, whether working from source database tables or supplied extracts; work with datasets that may exceed available memory; aggregate event-level data before joining; distinguish meaningful zeroes from missing information; and build validation and quality assurance into analytical workflows. It will also consider modular code, reusable functions, intermediate datasets and approaches that make analyses easier to rerun and maintain.

The workshop is intended as a practical exchange of experience rather than a comprehensive introduction to either R or the ONS SRS. Approximately 40–45 minutes will comprise taught material, followed by questions and peer discussion.

Who should attend?

ADR UK fellows and other researchers using, or preparing to use, R to analyse administrative data in the ONS Secure Research Service. The session may also be useful to researchers working in comparable trusted research environments.

Course pre-requisite

Participants should have a basic working knowledge of R and data manipulation. No advanced programming knowledge is required. Familiarity with the ONS Secure Research Service is helpful but not essential.

Skills areas & competencies

Skills area(s)

  • Definition, Acquisition, Engineering, Architect, Storage and Curation
  • Problem Solving, Analysis, Statistical Modelling, Visualisation
  • Evaluation and Reflection

Skills competencies

  • Data Engineering
  • Data Preparation and Feature Modelling
  • Data Analysis and Model Building
  • Sustainability and Best Practices
  • Reflective Practice and Ongoing Development

Learning outcomes

  1. Design an R analytical workflow that reflects the unit and structure of linked administrative data.
  2. Apply practical approaches for reducing computational and memory demands when working with large datasets in the SRS.
  3. Apply appropriate strategies for filtering, selecting, aggregating and storing data to minimise unnecessary data movement and repeated computation.
  4. Recognise common risks in dataset linkage, aggregation and missing-data handling, and implement appropriate validation checks.
  5. Apply reproducible and maintainable coding practices, including modular code, reusable functions, documentation and deliberate management of intermediate outputs.
  6. Reflect on alternative approaches to solving practical coding challenges in secure research environments.

Transferrable skills

  1. Reproducible research
  2. Computational problem solving
  3. Data management
  4. Analytical quality assurance
  5. Code documentation
  6. Collaborative working
  7. Reflective practice

Course format

The session will combine approximately 40–45 minutes of taught content with 15–20 minutes of questions and facilitated discussion. Teaching will draw on practical examples from large-scale linked administrative data analysis in the ONS SRS. Participants with previous SRS experience will be encouraged to share alternative approaches and good practices. No access to the ONS SRS or specialist software will be required during the session.

Course schedule

Time Description Tutor/speaker
14:00–14:05 Why R workflows need to be designed differently for large administrative data in a secure research environment Dr Justin Yang
14:05–14:12 Understanding data structure: analytical units, identifiers and join relationships Dr Justin Yang
14:12–14:20 Working with less data: filtering, selecting and reducing data before expensive processing Dr Justin Yang
14:20–14:28 Managing computational cost: memory, intermediate datasets and avoiding unnecessary recomputation Dr Justin Yang
14:28–14:36 Combining linked data safely: aggregation, join cardinality and event-level data Dr Justin Yang
14:36–14:42 Missingness, structural zeroes and validation checks Dr Justin Yang
14:42–14:45 Reproducible workflows: functions, documentation and designing code for reuse Dr Justin Yang
14:45–15:00 Q&A and facilitated peer discussion Dr Justin Yang

 

Tutor Bio

Dr Justin Yang is a Senior Research Fellow in the Division of Psychiatry at University College London. His research examines how mental health, vulnerability, and care trajectories can be understood from complex real-world data, including health records, linked administrative data, text, environmental exposures, and other forms of longitudinal evidence.

His work is concerned with a central problem in contemporary mental health research: how to make rigorous and responsible inferences from data that are often fragmented, incomplete, and shaped by the systems through which they are collected. Across his research, he studies patterns of distress, care, exclusion, inequality, recovery, and service contact, while remaining attentive to what routinely collected records can reveal and what they may obscure.

Trained across the biological sciences, humanities, public health, and psychiatric epidemiology, Justin brings a broad interdisciplinary perspective to mental health research. His background in cell biology, genetics, English literature, public health, and epidemiology informs an approach that combines scientific precision with close attention to the complexity of human lives.

Justin uses psychiatric epidemiology, causal inference, data linkage, natural language processing, spatial and environmental methods, and responsible data governance to study mental health at population scale. His work often focuses on the intersections between personal lives, social conditions, environments, and institutions, including schools, health services, social care, communities, and policy.

His current research includes studies of neurodivergent young people’s experiences across education and health systems, the social and emotional antecedents of severe mental illness, substance use and recovery, and the responsible use of routine mental health data. Across these areas, he aims to produce evidence that is methodologically rigorous, ethically grounded, and useful to researchers, services, policymakers, industry partners, and people with lived experience.

Alongside his academic role, Justin serves as research database deputy lead at North London NHS Foundation Trust, supporting the governance and scientific use of mental health records for public benefit. He is Associate Editor for Addiction and sits on the editorial board of Substance Use: Research and Treatment.

Justin completed his PhD in Public Health and Primary Care at the University of Cambridge, following postgraduate training at Johns Hopkins University and undergraduate study at the University of British Columbia.

Taught by
Dr Justin Yang