# https://github.com/r-lib/pkgdown/issues/2704

Skip to contents

A function used to calculate the number of risk factors the patient has. This is used to calculate the pretest probability of coronary artery disease (CAD) based on the ESC 2024 guidelines.

Usage

calculate_esc_2024_num_of_rf(
  have_family_history,
  have_smoking_history,
  have_dyslipidemia,
  have_hypertension,
  have_diabetes,
  max_na = 0
)

Arguments

have_family_history

Input characters (no, yes) to indicate if the patient only has a family history of CAD.

  • no stands for not having a family history of CAD.

  • yes stands for having a family history of CAD.

have_smoking_history

Input characters (no, yes) to indicate if the patient only has a smoking history (current or past smoker).

  • no stands for not having a smoking history (non-smoker).

  • yes stands for having a smoking history (current or past smoker).

have_dyslipidemia

Input characters (no, yes) to indicate if the patient only has dyslipidemia.

  • no stands for not having dyslipidemia.

  • yes stands for having a dyslipidemia.

have_hypertension

Input characters (no, yes) to indicate if the patient only has hypertension.

  • no stands for not having hypertension.

  • yes stands for having a hypertension.

have_diabetes

Input characters (no, yes) to indicate if the patient only has diabetes.

  • no stands for not having diabetes.

  • yes stands for having diabetes.

max_na

Input integer 0 to 5 to indicate the maximum number of missing risk factors to tolerate before outputting an NA. Default: 0

Value

An integer indicating the number of risk factors the patient has. It can also be NA if the number of missing risk factors exceeds the max_na input value

Examples

calculate_esc_2024_num_of_rf(
  have_family_history = "yes",
  have_smoking_history = "yes",
  have_dyslipidemia = "yes",
  have_hypertension = "yes",
  have_diabetes = "no"
)
#> [1] 4

calculate_esc_2024_num_of_rf(
  have_family_history = "no",
  have_smoking_history = "no",
  have_dyslipidemia = "no",
  have_hypertension = NA,
  have_diabetes = "no",
  max_na = 0
)
#> [1] NA

calculate_esc_2024_num_of_rf(
  have_family_history = "no",
  have_smoking_history = "no",
  have_dyslipidemia = "no",
  have_hypertension = NA,
  have_diabetes = "no",
  max_na = 1
)
#> [1] 0