Makes either a table of Data-Field and description, or a named vector handy for looking up descriptive name by column names in the UKB fileset tab file.

ukb_df_field(fileset, path = ".", data.pos = 2, as.lookup = FALSE)

Arguments

fileset

The prefix for a UKB fileset, e.g., ukbxxxx (for ukbxxxx.tab, ukbxxxx.r, ukbxxxx.html)

path

The path to the directory containing your UKB fileset. The default value is the current directory.

data.pos

Locates the data in your .html file. The .html file is read into a list; the default value data.pos = 2 indicates the second item in the list. (The first item in the list is the title of the table). You will probably not need to change this value, but if the need arises you can open the .html file in a browser and identify where in the file the data is.

as.lookup

If set to TRUE, returns a named vector. The default as.look = FALSE returns a dataframe with columns: field.showcase (as used in the UKB online showcase), field.data (as used in the tab file), name (descriptive name created by ukb_df)

Value

Returns a data.frame with columns field.showcase, field.html, field.tab, names. field.showcase is how the field appears in the online UKB showcase; field.html is how the field appears in the html file in your UKB fileset; field.tab is how the field appears in the tab file in your fileset; and names is the descriptive name that ukb_df assigns to the variable. If as.lookup = TRUE, the function returns a named character vector of the descriptive names.

See also

Examples

if (FALSE) {
# UKB field-to-description for ukb1234.tab, ukb1234.r, ukb1234.html

ukb_df_field("ukb1234")
}