#' @title
#' Handles Warnings Generated by Unexpected Data Types in Input Queries
#'
#' @description
#' The \code{handle_col_warnings()} function gives the user the option to stop
#' the processing pipeline in order to fix warnings generated by the input CEDAR query.
#' It is called after the \code{\link{log_warnings}} function is used to print warning messages
#' that result when data in one or more of the input query's columns does not match the
#' expected data type for those column(s) (as dictated by \code{\link{get_col_types}}). These
#' messages indicate the exact cell locations responsible, to aid in the user's decision
#' to stop or continue processing, as well as the process of fixing the specified cells,
#' if applicable.
#'
#' @export
handle_col_warnings <- function() {
user_yn <- askYesNo("At some or all of the cell locations indicated by the warning message in the console, the CEDAR query contains values that are not the expected data type (i.e. text in a column where a number would be expected).\n\n Do you wish to continue the processing pipeline with the input as is?",
prompts = getOption("askYesNo", gettext(c("Yes", "No", "Cancel")))
)
assign("last.warning", NULL, envir = baseenv()) # To do: test if need this
if (is.na(user_yn) || !user_yn) {
stop("Please fix the CEDAR query and then start the pipeline again.")
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.