R/tryerror.R

Defines functions isError

Documented in isError

#' Tell whether an object is an error
#' 
#' Determines whether an object is of class \code{try-error}
#' 
#' 
#' @param x Any object, potentially produced within a \code{try-error}
#' structure.
#' @return Logical value, \code{TRUE} if \code{x} inherits the \code{try-error}
#' class.
#' @author Jitao David Zhang <jitao_david.zhang@@roche.com>
#' @examples
#' 
#' if(exists("nonExistObj")) rm(nonExistsObj)
#' myObj <- try(nonExistObj/5, silent=TRUE)
#' isError(myObj)
#' 
#' @export isError
isError <- function(x) {
  inherits(x, "try-error")
}

Try the ribiosUtils package in your browser

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

ribiosUtils documentation built on March 13, 2020, 2:54 a.m.