R/safe_run.R

Defines functions safe_run

Documented in safe_run

#' Running function with safe mode
#'
#' @param func Functions to run
#'
#' @return Same as of functions
#' @export
#'
#' @examples
#' safe_run(print("Hello"))
safe_run <- function(func) {
  tryCatch(
    func,
    error = function(e) {
      message(conditionMessage(e))
      NULL
    }
  )
}

Try the LorMe package in your browser

Any scripts or data that you put into this service are public.

LorMe documentation built on Jan. 12, 2026, 9:06 a.m.