visit_mult_array: Extract data from two UK Biobank fields jointly

Description Usage Arguments Value

Description

Some fields relate to each other e.g. self-reported medical history where field 20002 contains the disclosed conditions and 20008 the date of diagnosis. The date in array i of 20008 corresponds to the condition in array i of 20002. visit_mult_array() jointly extracts such fields in a "long" format that is easier to work with than "wide" as provided by UK Biobank (NOTE: watch for type coercion of different data types).

Usage

1
visit_mult_array(visit_data, fields)

Arguments

visit_data

Data frame/table with UK Biobank data.

fields

Vector of fields to extract e.g. c(50, 21002). Must be length two. Field name will be identified from UK Biobank schema. Alternatively, field names can be set using a named vector e.g. c("height" = 50, "weight" = 21002).

Value

Data table with eid, reported, and columns corresponding to the fields argument. reported is the date corresponding to the field instance e.g. the UK Biobank visit at which the data was collected. Each row shows the data for an array.


philipdarke/ukbbhelpr documentation built on Dec. 22, 2021, 7:49 a.m.