R/showSpecialMessage.R

Defines functions showSpecialMessage

showSpecialMessage <- function(...,envir=parent.frame()){
    temp <- tempfile()
    nullcon <- file(temp, open = "wb")
    sink(nullcon, type = "message")
    expr <- substitute(...)
    tryCatch(eval(expr,envir = envir),
             error=function(e) list(error=conditionMessage(e))) |>
            suppressWarnings()
    sink(type = "message")
    close(nullcon)
    msg <- readLines(temp,encoding = 'UTF-8')
    unlink(temp)
    msg
}
yikeshu0611/nhanesR documentation built on Jan. 29, 2022, 6:08 a.m.