Skip to contents

This function evaluates a respondent's family history of cardiovascular disease (CVD), based on data about diagnoses of heart disease and stroke in immediate family members and the ages at which these diagnoses occurred. It identifies premature CVD if any diagnosis occurred before age 60.

Usage

determine_CVD_family_history(FMH_11, FMH_12, FMH_13, FMH_14)

Arguments

FMH_11

integer An integer: Indicates whether an immediate family member was diagnosed with heart disease. - 1 for "Yes" - 2 for "No".

FMH_12

numeric A numeric: Represents the youngest age at diagnosis of heart disease in an immediate family member.

FMH_13

integer An integer: Indicates whether an immediate family member was diagnosed with stroke. - 1 for "Yes" - 2 for "No".

FMH_14

numeric A numeric: Represents the youngest age at diagnosis of stroke in an immediate family member.

Value

integer The CVD family history:

  • 1: "Yes" — Family history of premature CVD exists (diagnosis before age 60).

  • 2: "No" — No family history of premature CVD.

  • haven::tagged_na("a"): Not applicable

  • haven::tagged_na("b"): Missing

Details

This function assesses family history of premature cardiovascular disease (CVD), a significant risk factor for personal CVD development.

     **Missing Data Codes:**
     - `FMH_11`, `FMH_13`:
       - `6`: Valid skip. Handled as `haven::tagged_na("a")`.
       - `7-9`: Don't know, refusal, or not stated. Handled as `haven::tagged_na("b")`.
     - `FMH_12`, `FMH_14`:
       - `996`: Valid skip. Handled as `haven::tagged_na("a")`.
       - `997-999`: Don't know, refusal, or not stated. Handled as `haven::tagged_na("b")`.

Examples

# Scalar usage: Single respondent
# Example 1: Premature CVD due to heart disease diagnosis at age 50
determine_CVD_family_history(FMH_11 = 1, FMH_12 = 50, FMH_13 = 2, FMH_14 = NA)
#> [1] 1
# Output: 1

# Example 2: Respondent has non-response values for all inputs.
result <- determine_CVD_family_history(FMH_11 = 8, FMH_12 = 998, FMH_13 = 8, FMH_14 = 998)
result # Shows: NA
#> [1] NA
haven::is_tagged_na(result, "b") # Shows: TRUE (confirms it's tagged NA(b))
#> [1] TRUE
format(result, tag = TRUE) # Shows: "NA(b)" (displays the tag)
#> [1] "NA"

# Multiple respondents
determine_CVD_family_history(
  FMH_11 = c(1, 2, 1), FMH_12 = c(50, NA, 70),
  FMH_13 = c(2, 1, 2), FMH_14 = c(NA, 55, NA)
)
#> [1] 1 1 2
# Returns: c(1, 1, 2)

# Database usage: Applied to survey datasets
library(dplyr)
# dataset %>%
#   mutate(cvd_family_history = determine_CVD_family_history(FMH_11, FMH_12, FMH_13, FMH_14))