找回密码
 注册
查看: 5329|回复: 0

R语言:stop()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 18:55:37 | 显示全部楼层 |阅读模式
stop(base)
stop()所属R语言包:base

                                        Stop Function Execution
                                         停止执行函数

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

stop stops execution of the current expression and executes an error action.
stop停止执行当前表达式并执行一个错误的行动。

geterrmessage gives the last error message.
geterrmessage给的最后一个错误消息。


用法----------Usage----------


stop(..., call. = TRUE, domain = NULL)
geterrmessage()



参数----------Arguments----------

参数:...
zero or more objects which can be coerced to character (and which are pasted together with no separator) or a single condition object.
零个或多个对象可以强制转换为字符(并粘贴在一起,没有分隔)或一个单一的条件对象。


参数:call.
logical, indicating if the call should become part of the error message.
逻辑,表示如果调用应该成为错误信息的一部分。


参数:domain
see gettext. If NA, messages will not be translated.
看到gettext。如果NA,消息不会被翻译。


Details

详情----------Details----------

The error action is controlled by error handlers established within the executing code and by the current default error handler set by options(error=).  The error is first signaled as if using signalCondition().  If there are no handlers or if all handlers return, then the error message is printed (if options("show.error.messages") is true) and the default error handler is used.  The default behaviour (the NULL error-handler) in interactive use is to return to the top level prompt or the top level browser, and in non-interactive use to (effectively) call q("no", status=1, runLast=FALSE). The default handler stores the error message in a buffer; it can be retrieved by geterrmessage().  It also stores a trace of the call stack that can be retrieved by traceback().
由内执行options(error=)设置当前的默认错误处理程序代码和错误处理程序的错误动作的控制。错误的第一信号,如果使用signalCondition()。如果有没有处理,或者如果所有处理程序返回,然后打印错误消息(options("show.error.messages")如果是真实的),并使用默认的错误处理程序。 (NULL错误处理)交互使用的默认行为是返回到顶层提示或顶层浏览器,并在非交互使用(有效)调用q("no", status=1, runLast=FALSE)。默认的处理程序存储在缓冲区中的错误消息,它可以由geterrmessage()检索。它还存储了可以traceback()检索调用堆栈跟踪。

Errors will be truncated to getOption("warning.length") characters, default 1000.
错误将被截断getOption("warning.length")字符,缺省为1000。

If a condition object is supplied it should be the only argument, and further arguments will be ignored, with a warning.
如果条件对象提供的,它应该是唯一的参数,警告,进一步的参数将被忽略。


值----------Value----------

geterrmessage gives the last error message, as a character string ending in "\n".
geterrmessage给最后一个错误消息,作为一个字符"\n"结尾的字符串。


参考文献----------References----------

The New S Language. Wadsworth & Brooks/Cole.

参见----------See Also----------

warning, try to catch errors and retry, and options for setting error handlers. stopifnot for validity testing.  tryCatch and withCallingHandlers can be used to establish custom handlers while executing an expression.
warning,try发现错误,重试,options设置的错误处理。 stopifnot有效性测试。 tryCatch和withCallingHandlers可以用来建立自定义的处理程序,同时执行一个表达式。

gettext for the mechanisms for the automated translation of messages.
gettext自动翻译的消息机制。


举例----------Examples----------


options(error = expression(NULL))
# don't stop on stop(.)  &lt;&lt; Use with CARE! &gt;&gt;[不停止(停止)。<<使用,小心! >>]

iter <- 12
if(iter > 10) stop("too many iterations")

tst1 <- function(...) stop("dummy error")
tst1(1:10, long, calling, expression)

tst2 <- function(...) stop("dummy error", call. = FALSE)
tst2(1:10, longcalling, expression, but.not.seen.in.Error)

options(error = NULL)# revert to default[恢复到默认]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-5-4 18:37 , Processed in 0.022598 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表