[英]Can I trap signals in R?
In bash I can trap SIGINT
, SIGKILL
, SIGTERM
, and so on. 在bash中我可以捕获
SIGINT
, SIGKILL
, SIGTERM
等。 That allows me to do different things depending how the program was unexpectedly stopped. 这允许我根据程序意外停止的方式做不同的事情。
Is there a way to do this in R? 在R中有办法做到这一点吗?
Expanding a bit on my comment which OP asked me to post as an answer 我的评论扩大了一点,OP要求我发帖作为答案
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. 另外,
tools::assertCondition
也值得一看。 It is linked at the bottom of the conditions documentation. 它链接在条件文档的底部。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.