使R退出非零状态代码

时间:2011-10-06 22:27:33

标签: r exit

我正在寻找R /等效的linux / POSIX exit(n),它将使用退出代码n暂停进程,向父进程发出错误信号。 R有这样的设施吗?

2 个答案:

答案 0 :(得分:59)

这是quit()的论据。请参阅?quit

参数

status: the (numerical) error status to be returned to the operating
        system, where relevant.  Conventionally ‘0’ indicates
        successful completion.

详细

 Some error statuses are used by R itself.  The default error
 handler for non-interactive use effectively calls ‘q("no", 1,
 FALSE)’ and returns error code 1.  Error status 2 is used for R
 ‘suicide’, that is a catastrophic failure, and other small numbers
 are used by specific ports for initialization failures.  It is
 recommended that users choose statuses of 10 or more.

答案 1 :(得分:1)

nodeAdmin

quit(status=1) 替换为您需要的退出代码。