R/boa.getinput.R

boa.getinput <- function(message, n = 1, evaluate = TRUE)
{
   repeat {
      cat(message)
      input <- scan(what = "", n = n, sep = "\n")
      if(evaluate) value <- try(eval(parse(text = input)), TRUE)
      else value <- try(parse(text = input), TRUE)
      if(inherits(value, "try-error")) cat("Warning: syntax error\n")
      else break
   }

   value
}

Try the boa package in your browser

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

boa documentation built on May 1, 2019, 9:12 p.m.