Skip to contents

Reformats the UK Biobank primary care prescriptions dataset to match the output format for tidy_clinical_events.

Usage

tidy_gp_scripts(gp_scripts, .details_only = FALSE)

Arguments

gp_scripts

The UK Biobank primary care prescriptions dataset

.details_only

logical. If TRUE, return a character vector of output table names only

Value

A named list. Item 'clinical_events' contains the read codes with event dates, and item 'gp_scripts_names_and_quantities' contains the drug names/quantities columns.

Details

The UK Biobank primary care prescriptions data has multiple code columns (Read, BNF and DMD codes). This function reshapes the data to long format so that all codes are in a single column. The index column values relate to row numbers in the original data.

The primary care data also contains drug name and quantities columns. The clinical codes/dates in long format and drug name/quantity columns are both returned in a list under the names 'clinical_events' and 'gp_scripts_names_and_quantities' respectively.

Other notes

By default, special date values (see resource 591 for further details) are set to NA.