estimates_exist | R Documentation |
Check whether stratum estimates already exist in pre-calculated files.
estimates_exist(stratum_data_prepped, estimates_dir)
stratum_data_prepped |
A data frame including all records in a stratum of
interest. The data frame should only include the source columns prefixed with
|
estimates_dir |
Directory containing pre-calculated estimates, if you would like to use pre-calculated results. |
A list with two entries, estimates_exist
and estimates_path
.
estimates_exist
is a logical value indicating whether calculations for the
stratum of interest are available in the directory containing the pre-calculated
estimates. If estimates_exist
is TRUE
, estimates_path
will contain the
full file path to the JSON file containing the estimates, otherwise it will
be NA
.
in_A <- sample(c(0, 1), size = 100, replace = TRUE, prob = c(0.45, 0.65))
in_B <- sample(c(0, 1), size = 100, replace = TRUE, prob = c(0.5, 0.5))
in_C <- sample(c(0, 1), size = 100, replace = TRUE, prob = c(0.75, 0.25))
in_D <- sample(c(0, 1), size = 100, replace = TRUE, prob = c(1, 0))
my_stratum <- tibble::tibble(in_A, in_B, in_C, in_D) %>%
dplyr::mutate(rs = rowSums(.)) %>%
dplyr::filter(rs >= 1) %>%
dplyr::select(-rs)
estimates_exist(stratum_data_prepped = my_stratum, estimates_dir = "path_to_estimates")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.