Description Usage Arguments Value Examples
Extracts all instances/arrays of data for a UK Biobank
field(s) in clean "long" format (NOTE: watch for type coercion of
different data types). See https://biobank.ndph.ox.ac.uk/showcase/
to identify field codes. Wrapper for visit_fields()
which extracts
raw field data.
1 | visit_extract(visit_data, fields, format = NULL)
|
visit_data |
Data frame/table with UK Biobank data. |
fields |
Vector of fields to extract e.g. |
format |
Format of output table ( |
Data table with values of all instances/arrays for each field in "long" format. The following columns are provided:
UK Biobank identifier.
Visit date.
Field name (see below).
Provided if any fields have multiple arrays (more than one value recorded on the same date e.g repeated blood pressure).
Value recorded.
If format
= "source", an additional column source
= "ukbb" is
added to indicate data was recorded by UK Biobank and the field column is
renamed variable
. This will be the default in a future release. Use
format
= "raw" to keep current format.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
# Load data
data_path <- "" # add path to your data
visit_data <- fread(data_path)
# Extract a field
visit_extract(visit_data, 50)
# Extract multiple fields
visit_extract(visit_data, c(50, 21002))
# Manually specify a field name
visit_extract(visit_data, c("height" = 50, 21002))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.