visit_family_history: Determine family history of a specified condition

Description Usage Arguments Value Examples

Description

Determines presence of a specified condition in the self-reported family history data. If multiple history fields are provided (e.g. history of mother and father), presence of the condition in either field determines a positive family history.

Usage

1
2
3
4
5
6
7
visit_family_history(
  visit_data,
  fields,
  condition,
  collapse = TRUE,
  name = NULL
)

Arguments

visit_data

Data frame/table with UK Biobank data.

fields

Vector of family history fields to extract e.g. one or more from 20107 (father), 20110 (mother) or 20111 (sibling).

condition

Code for condition. Only a single condition at a time is currently supported. See https://biobank.ndph.ox.ac.uk/showcase/coding.cgi?id=1010 to identify condition codes.

collapse

Summarise results across all visit dates (default TRUE). If FALSE, the presence of the condition is provided at each visit date in the output table.

name

Optional column name for condition (default history).

Value

Data table with TRUE (condition was reported), FALSE (condition was not reported) or NA (unknown/no response).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
# Load data
data_path <- ""  # add path to your data
visit <- fread(data_path)

# Extract history for father
visit_family_history(visit, 20107, 9)

# Extract history for father, mother and siblings
visit_family_history(visit, c(20107, 20110, 20111), 9)

# Name column in output
visit_family_history(visit, c(20107, 20110, 20111), 9, name = "diabetes")

# Get history reported at each visit date
visit_family_history(visit, c(20107, 20110, 20111), 9, collapse = FALSE)

## End(Not run)

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