R/utils_warn.R

Defines functions warn_once

warn_once <- function(msg, id) {
    id <- paste0("modelsummary_warning_", id)
    msg <- paste(msg, "This warning appears once per session.")
    if (isTRUE(getOption(id, default = TRUE))) {
        warning(msg, call. = FALSE)
        opts <- list(FALSE)
        names(opts) <- id
        options(opts)
    }
}
vincentarelbundock/gtsummary documentation built on Nov. 6, 2024, 11:07 p.m.