break/exit script

前端 未结 8 1266
Happy的楠姐
Happy的楠姐 2021-01-30 15:22

I have a program that does some data analysis and is a few hundred lines long.

Very early on in the program, I want to do some quality control and if there is not enou

8条回答
  •  感情败类
    2021-01-30 16:05

    Here:

    if(n < 500)
    {
        # quit()
        # or 
        # stop("this is some message")
    }
    else
    {
        *insert rest of program here*
    }
    

    Both quit() and stop(message) will quit your script. If you are sourcing your script from the R command prompt, then quit() will exit from R as well.

提交回复
热议问题