is_consistent_population_events <- function(population, events) {
events1 <- events[[1L]]
classif_vars_popn <- make_classif_vars(population)
classif_vars_events <- make_classif_vars(events1)
if (!identical(sort(classif_vars_popn), sort(classif_vars_events)))
stop(gettextf("'%s' and '%s' have different classifying variables",
"population", "events"))
is_t0 <- with(population, time == min(time))
popn_noninit <- populaton[!is_t0, ]
classif_popn <- popn_noninit[classif_vars_popn]
classif_events <- events1[classif_vars_popn]
val <- all.equal(classif_popn, classif_events)
if (!isTRUE(val))
stop(gettextf("classification variables for '%s' and '%s' inconsistent : %s",
"population", "events"))
invisible(TRUE)
}
events_rates_consistent <- function(events, rates) {
if (!setequal(names(events), names(rates)))
stop(gettextf("'events' and 'rates' have different colnames"))
classif_vars <- c("age", "cohort", "sex", "time")
has_reg <- "region" %in% names(events)
if (has_reg)
classif_vars <- c(classif_vars, "region")
classif_events <- events[classif_vars]
classif_rates <- rates[classif_vars]
classif_events <- classif_events[order(classif_events), ]
classif_rates <- classif_rates[order(classif_rates), ]
val <- all.equal(classif_events, classif_rates)
if (!isTRUE(val))
stop("classification variables for 'events' and 'rates' inconsistent : ", val)
invisible(TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.