Can I trap signals in R?

≡放荡痞女 提交于 2019-11-30 17:56:54

问题


In bash I can trap SIGINT, SIGKILL, SIGTERM, and so on. That allows me to do different things depending how the program was unexpectedly stopped.

Is there a way to do this in R?


回答1:


Expanding a bit on my comment which OP asked me to post as an answer


The help file for conditions has the description

These functions provide a mechanism for handling unusual conditions, including errors and warnings.

There are many handling functions explained in the file, with examples. So I suggest starting with

help(conditions)
## and
example(conditions)

Additionally, tools::assertCondition might be worth a look too. It is linked at the bottom of the conditions documentation.



来源:https://stackoverflow.com/questions/27950443/can-i-trap-signals-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!