Stop an R program without error

前端 未结 9 1634
执笔经年
执笔经年 2020-12-01 10:35

Is there any way to stop an R program without error?

For example I have a big source, defining several functions and after it there are some calls to the functions.

9条回答
  •  余生分开走
    2020-12-01 11:17

    There is a nice solution in a mailing list here that defines a stopQuietly function that basically hides the error shown from the stop function:

    stopQuietly <- function(...) {
      blankMsg <- sprintf("\r%s\r", paste(rep(" ", getOption("width")-1L), collapse=" "));
      stop(simpleError(blankMsg));
    } # stopQuietly()
    
    > stopQuietly()
    

提交回复
热议问题