R/evalOrEcho.R

Defines functions evalOrEcho

Documented in evalOrEcho

evalOrEcho <- function(x, resultMode = NULL, n = 0){
  if(is.null(x)) 
    return(NULL)
  if(is.numeric(x) || inherits(x, "ti")) return(x)
  oldOpt <- options(show.error.messages = FALSE)
  boink <- try(eval.parent(parse(text = x), n = n + 1))
  if(inherits(boink, "try-error") ||
     (!is.null(resultMode) && 
      mode(boink) != resultMode)) 
    boink <- x
  options(oldOpt)
  return(boink)
}

Try the tis package in your browser

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

tis documentation built on Sept. 29, 2021, 1:06 a.m.