Ethnicity_self_reported: Self-reported ethnicity, simplified

ethnicity_self_reportedR Documentation

Self-reported ethnicity, simplified

Description

Simplifies ethnicity codings (as specified in https://biobank.ctsu.ox.ac.uk/crystal/coding.cgi?id=1001) to the parent category (e.g., converts White-British to White, and Black-African to Black). If reported ethnicity is not consistent across instances (there are a few), returns "Other" for that participant.

Usage

ethnicity_self_reported(data, ethnicity_col = f.21000.0.0.Ethnic_background)

Arguments

data

The primarydata frame.

Thisdata frame includes all necessary columns required to perform look-ups (e.g. ICD10 code columns, medication code columns, age, sex, etc.).

ethnicity_col

Template column name for ethnic background.
Default = f.21000.0.0.Ethnic_background.

Column names

Most functions in this package will take column names (*_col) as optional arguments (otherwise a default column names are used) which are then used as templates to find all other columns with the same field number, but different instance and array numbers. These functions will automatically find all matching instances (and arrays within each instance) within the specified parameters. Internally, a set of expand_instance_*() helper functions, which themselves rely on the column_expansion_helper() function, perform the work of searching for matching columns.


adamleejohnson/R-ukbiobank documentation built on April 25, 2022, 2:11 a.m.