Generate a sample dashboard from salic (rather than the full version)
run_visual(), etc.:
We might want tests using testthat (similar to what was done in salic). Making changes to code is quite a pain currently b/c it is laborious to find things like syntax errors. Although even including examples (which get run with R CMD check) would improve this.
It may be that functions will need to be tweaked, improved, etc. on the backend. However, it is difficult to do that reliably without tests (and probably sample data). Therefore, any changes should begin with tests to ensure that functionality is not broken, or a change to a function leads to an error in calculation.
#' Estimate participants
#'
#' This is basically a wrapper for salic::est_part() that filters out non-dashboard_yrs
#' for county-level results
#'
#' @params dashboard_yrs years for dashboard focus
#' @export
est_part <- function(
history, segment = "tot", test_threshold = 20, show_test_stat = FALSE,
suppress_warning = FALSE, outvar = "participants", dashboard_yrs
) {
if (segment == "county") {
history <- filter(history, year %in% dashboard_yrs)
}
salic::est_part(history, segment, test_threshold, show_test_stat,
suppress_warning, outvar)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.