User-visible changes:
The zip argument in the estimate_risk() function (and its synonym est_risk()) gains the ability to accept SDI decile values directly. The zip arugment retains all previous functionality (so this is merely a feature addition that maintains backwards compatibility).
I have updated the documentation for the zip argument in accordance with its new ability.
Internal changes:
Additional tests to test the zip argument's new ability (both in single calls and in calls using a data frame)
Add helper function get_zip() (pairs with existing helper get_sdi()) plus tests for this new helper function
Minor tweaks to get_sdi(), is_valid_zip(), and is_zip_with_sdi_data() as part of the zip argument's new ability
Correct label typos in the sysdata.rda file for the 10-year full model. This is strictly a typographical change and has no impact on the calculations or functionality of the package. The changes pertain to the string/character value for three of the coefficient descriptions stemming from the update to the HbA1c coefficients released in 0.12.1. Thanks to @heksbeks for notifying me of this (and this is similar to the typo issue @kcjw87 noticed previously and which was corrected as part of 0.12.0). Because I was reviewing the coefficient descriptions, I also made some additional tweaks to select descriptions across all models just for good measure/clarity (e.g., the age coefficient), but again, nothing about these changes have any impact on the functionality or calculations of the package (said more directly, calculations with 0.12.1 are identical to those with 0.12.2).
User-visible changes:
This is a patch to implement the correction issued by the authors of the PREVENT equations on 2026-10-14 for models that use the HbA1c coefficients (i.e., the 10- and 30-year HbA1c models and the 10- and 30-year full models).
This correction was formally published as an erratum (https://doi.org/10.1161/CIR.0000000000001491), and it was also accompanied by a notification on their website page for their calculator (https://professional.heart.org/en/guidelines-and-statements/prevent-calculator) with an accompanying PDF of FAQs (https://professional.heart.org/-/media/PHD-Files/Guidelines-and-Statements/PREVENT/PREVENT-Update-FAQ-101426.pdf).
Minor updates to documentation stemming from new notes returned during checks of the package before submission. This was due to citations occassionally pointing to PubMed instead of using DOIs, with the new notes indicating these should be converted to DOIs. As a result of these changes, the estimate_risk() / est_risk() function documentation now has a dedicated "References" section that points to key references.
Internal changes:
User-visible changes:
This version introduces:
plot_risk(), a function that plots risk estimates generated by estimate_risk() / est_risk()
A new vignette "plot-risk" to accompany the new function
The ability to pass a data frame as the first argument of estimate_risk() / est_risk()
(e.g., instead of est_risk(use_dat = df), users can now do est_risk(df), which will automatically
translate to est_risk(use_dat = df) in the background; see the updated function documentation for
more information)
Minor tweaks and additions to existing documentation
Internal changes:
Rename "prevent_equations.R" to "estimate_risk.R"
Add test suite for plot_risk()
Correct a typo in a label in the sysdata.rda file for one of the coefficients;
this is strictly a typographical change in the string/character value for one of the coefficient descriptions, and it has no impact on the calculations or functionality of the package. This stemmed from errant labeling in the original publication of the PREVENT equations (i.e., the publication itself contained the same typo). Thanks to @kcjw87 for reporting this. Details, for those interested, are available at: https://github.com/martingmayer/preventr/issues/2 (#2).
User-visible changes:
All changes specified for estimate_risk() also apply to its synonym,
est_risk(). There are no breaking changes, only enhancements.
Users can now compare results with either the original Pooled Cohort
Equations (PCEs) released by the ACC/AHA in 2013 or the revised PCEs released
by Yadlowsky and colleagues in 2018. This is implemented via expanding the
set of valid input options for the existing argument model within the
estimate_risk() function. The Shiny app has also been updated to permit
estimation via the PCEs.
Function arguments for estimate_risk() are now semantically categorized as
one of the following: required predictor variable, optional predictor
variable, optional behavior variable. This is to help with clarity of
documentation and additional features in the package. Nothing has actually
changed about which arguments are required or the behavior of those arguments.
The function estimate_risk() gains the optional behavior argument
collapse, which allows users to collapse the list of tibbles into a single
tibble when relevant. To maintain backwards compatibility, this is an opt-in
feature, so the default of collapse is FALSE.
The function estimate_risk() gains the optional behavior arguments
use_dat and add_to_dat, which allow users to pass a data frame (as a
data.frame, tibble, or data.table) to the function to carry out risk
estimation against a large set of data in one function call, with the option
(via add_to_dat = TRUE) to append the results to the data frame passed to
the function. This is accompanied by vignette("using-data-frame"), which
gives many examples, and also shows how to use a data frame for input even if
you do not want to use use_dat and add_to_dat.
The function estimate_risk() gains the optional behavior argument
progress, which gives users the option to display a progress bar in the
console when use_dat is a data frame. This argument is independent of
quiet.
All the above changes also have corresponding documentation within the relevant function and corresponding sections of the documentation.
Internal changes:
Minor edits to is_valid_* functions (adding extra_text arg)
Addition of new is_valid_* functions in support of estimating with other
models
Expansion of verification for is_okay_type() stemming from expansion of
functionality with use_dat and add_to_dat
Minor refactoring of some of the messaging functions within
estimate_risk(), including creation of new messaging for other models and
scenarios specific to the use_dat and add_to_dat arguments
Considerable addition of other helper functions and capabilities in support
of estimating with other models and the use_dat and add_to_dat arguments
Moving internal_call_* <- TRUE to inside relevant sections and changing
name to *_requested
Refactoring of method to return tibble of NAs when there are input problems
Many more tests for added functionality
User-visible changes:
Shiny app available online at https://martingmayer.shinyapps.io/prevent-equations/ or https://tiny.cc/prevent-equations,
and users can also access this via app()
Arguments egfr and bmi within the estimate_risk() function (and its
synonym est_risk()) gain the ability to accept a call to a corresponding,
non-exported function rather than passing the corresponding value directly;
entering the value directly remains an option (and there is no intent for
that to change)
For egfr, the supported call is calc_egfr() (or a synonym)
For bmi, the supported call is calc_bmi() (or its synonym)
estimate_risk() and est_risk() now advise 30-year risk prediction for
people > 59 years is questionable via two warnings:
In the console (that can be suppressed by setting quiet = TRUE)
In the column input_problems of the return tibble (quiet has no
impact here)
All the above changes also have corresponding documentation within the relevant function
Internal changes:
Moved message_maybe(), warn_maybe(), and valid to helpers
Added tests for new functionality