extract_biomarkers {ukbnmr} | R Documentation |
Extract NMR metabolomic biomarkers from a data.frame of UK Biobank fields
Description
Given an input data.frame
loaded from a dataset extracted by
ukbconv
extracts the UK Biobank fields
corresponding to the
NMR metabolomics biomarkers
giving them short variable names as listed in the nmr_info
information data sheet
available in this package.
Usage
extract_biomarkers(x)
Arguments
x |
|
Details
Data sets extracted by
ukbconv
have one row per UKB biobank participant whose project specific sample
identifier is given in the first column named "eid". Columns following this
have the format "<field_id>-<visit_index>.<repeat_index>", where here <field_id>
corresponds to a biomarker of interest, e.g. 23474 for 3-Hydroxybutyrate,
<visit_index> corresponds to the assessment time point, e.g. 0 for baseline
assessment, 1 for first repeat visit. For the UKB NMR data, the <repeat_index>
column is reserved for cases where biomarker measurements have more than
one QC Flag (see extract_biomarker_qc_flags()
).
In the returned data.frame
there is single column for each biomarker,
with an additional column for the visit index. Rows are uniquely identifiable
by the combination of entries in columns "eid" and "visit_index". There are
currently no repeat measure data for the NMR biomarker data in UKB,
so no repeat_index column is returned.
This function will also work with data extracted by the ukbtools
R
package.
If your UK Biobank project only has access to a subset of biomarkers, then this function will only return the subset of ratios that can be computed from the biomarker data provided.
A data.table
will be returned instead of a data.frame
if the
the user has loaded the package into their R session.
Value
a data.frame
or data.table
with column names "eid",
and "visit_index", followed by columns for each biomarker
e.g. "bOHbutyrate", ..., "Valine".
Examples
ukb_data <- ukbnmr::test_data # Toy example dataset for testing package
nmr <- extract_biomarkers(ukb_data)