#' @title Test if Message Produced
#' @description Tests if a given expression produces a message.
#' @param expr expression to test.
#' @return TRUE if a message is prodcued, FALSE otherwise.
#' @examples
#' msgFun <- function() message("Test Function")
#' noMsgFun <- function() return("Test Function")
#' testMessage(msgFun()) # TRUE
#' testMessage(noMsgFun()) # FALSE
#' @export
testMessage <- function(expr){
if(inherits(tryCatch(expr, message = function(m) m), "message"))
return(TRUE)
else
return(FALSE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.