knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
To calculate the HEP Billion, there are a series of functions made available through the billionaiRe package:
transform_hep_data()
to transform raw values into normalized values used within the calculations. For now, this is primarily calculating the total prevent numerators and denominators for campaign and routine data.calculate_hep_prevent_ind
to calculate the sub-indicator for 'prevent'.calculate_hep_components()
to calculate the HEP index, and levels for all components.calculate_hep_billion()
to calculate the change for the three HEP components (DNR, Prepare, and Prevent), their contribution to the Billion, and overall HEPI change and contribution.Run in sequence, these can calculate the entire HEP Billion, or they can be run separately
to produce different outputs as required. Details on the inputs of each function are
available in their individual documentation, but below you can see the quick
and easy Billions calculation done using the sample fake HEP data provided
in the package, hep_df
.
library(billionaiRe) hep_df %>% transform_hep_data() %>% calculate_hep_components() %>% calculate_hep_prevent_ind() %>% calculate_hep_billion(end_year = 2023) %>% dplyr::filter(ind %in% c("prevent", "espar", "detect_respond", "hep_idx"), year == 2023)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.