Wrapper around the PooledCohort ASCVD calculators with added input validation, optional data-quality warnings, and quiet failure to NA if the backend errors.
Arguments
- data
A data frame with columns:
age,sex(1 = male, 0 = female),race("white","black","other"),smoker(logical),total_chol,HDL_c,sbp,bp_treated(logical),diabetes(logical),bmi.- year
Risk horizon: 10 or 30.
- na_warn_prop
Proportion (0-1) to flag high missingness warnings (default 0.2). Only used when
verbose = TRUE; underlying backend handles NA as per its API.- verbose
Logical; if TRUE, prints progress and a short summary.
- ...
Passed to the underlying PooledCohort function.
References
Goff DC, Lloyd-Jones DM, Bennett G, Coady S, D'Agostino RB, et al. (2014). “2013/2014 ACC/AHA Guideline on the Assessment of Cardiovascular Risk.” Circulation, 129(25 Suppl 2), S49–S73. doi:10.1161/01.cir.0000437741.48606.98 , Pooled Cohort Equations; ACC/AHA Task Force on Practice Guidelines.
Examples
df <- tibble::tibble(
age = 55, sex = 1, race = "white", smoker = FALSE,
total_chol = 200, HDL_c = 50, sbp = 140, bp_treated = FALSE,
diabetes = FALSE, bmi = 27
)
if (requireNamespace("PooledCohort", quietly = TRUE)) {
cvd_risk_ascvd(df, year = 10, verbose = TRUE)
}
#> cvd_risk_ascvd(): preparing inputs; non-finite=1 var(s), high-NA=1, all-NA=1
#> cvd_risk_ascvd(): results: 10yr risk, 1 row(s)
#> # A tibble: 1 × 3
#> model year risk
#> <chr> <int> <dbl>
#> 1 ASCVD 10 0.0652