ukb_fields2long: Take in a UKB data.frame and return instances split across...

Description Usage Details Examples

Description

UKB variables are formatted as f.FIELD.INSTANCE.ARRAY where FIELD is the variable INSTANCE is the assessment occasion ARRAY are multiple responses to the variable assessed at the same time.

Usage

1

Details

What we want to do is turn the data from

f.eid f.1.0.0 f.1.1.0 1 4 5 2 17 2

to

f.eid instance f.1.0 1 0 4 1 1 5 2 0 17 2 1 2

Some care in interpeting what the 'instance' refers to as different variables use different codings of instance:

1. Diet Questionnaires Cycle http://biobank.ctsu.ox.ac.uk/crystal/instance.cgi?id=1 2. Assessment Centre Visit http://biobank.ctsu.ox.ac.uk/crystal/instance.cgi?id=2

Instance coding 2 is more useful for most analyses 0 = Initial assessment visit (2006-2010) at which participants were recruited and consent given 1 = First repeat assessment visit (2012-13) 2 Imaging visit (2014+)

These can be matched with f.53 Date of attending assessment center http://biobank.ctsu.ox.ac.uk/crystal/field.cgi?id=53 to determine exactly the length of time between instances

Examples

1
  ukb_long <- ukb_fields2long(ukb)

ccbs-stradl/ukbiobanker documentation built on May 28, 2019, 2:52 p.m.