Stop an R program without error

前端 未结 9 1549
执笔经年
执笔经年 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:29

    In addition to answer from Stibu on Mar 22 '17 at 7:29, if you want to write a message as a part of stop(), this message is not written.

    I perceive strange that following two lines have to be used meaning on.exit(options(options(show....))) doesn't work.

    opt <- options(show.error.messages = F)
    on.exit(options(opt))
    
    0 讨论(0)
  • 2020-12-01 11:31

    You're looking for the function browser.

    0 讨论(0)
  • 2020-12-01 11:34

    why not just use an if () {} else {}? It's only a couple of characters...

    f1 <- function(){}
    f2 <- function(){}
    
    if (justUpdate) {
    } else {
    # main body 
    }
    

    or even

    f1 <- function(){}
    f2 <- function(){}
    
    if (!justUpdate) {
    # main body 
    }
    
    0 讨论(0)
提交回复
热议问题