http://web.mit.edu/r/current/lib/R/library/base/html/options.html
error
:either a function or an expression governing the handling of non-catastrophic errors such as those generated by
stop
as well as by signals and internally detected errors. If the option is a function, a call to that function, with no arguments, is generated as the expression. The default value isNULL
: seestop
for the behaviour in that case. The functionsdump.frames
andrecover
provide alternatives that allow post-mortem debugging. Note that these need to specified as e.g.options(error = utils::recover)
in startup files such as ‘.Rprofile’.
# 需要跳过错误,继续运行下面的代码。可以设置option(error=...)
# Will continue to execute script even after error, when options()$error is not NULL
options(error = function(){cat('continue to execute script even after error.\n')})
转载本文请联系原作者获取授权,同时请注明本文来自张兵科学网博客。
链接地址:https://wap.sciencenet.cn/blog-331295-1383646.html?mobile=1
收藏