Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 bash 中,我可以捕获SIGINT、SIGKILL、SIGTERM等。这使我可以根据程序意外停止的方式做不同的事情。
SIGINT
SIGKILL
SIGTERM
有没有办法在 R 中做到这一点?
扩展我的评论,OP要求我发布作为答案
条件的帮助文件有描述
这些函数提供了一种处理异常情况的机制,包括错误和警告。
文件中解释了许多处理函数,并附有示例。所以我建议从
help(conditions) ## and example(conditions)
此外,tools::assertCondition可能也值得一看。它链接在条件文档的底部。
tools::assertCondition