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

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

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

                                        Debug a Function
                                         调试功能

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

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

Set, unset or query the debugging flag on a function. The text and condition arguments are the same as those that can be supplied via a call to browser. They can be retrieved by the user once the browser has been entered, and provide a mechanism to allow users to identify which breakpoint has been activated.
在功能设置,设置或者查询调试标志。 text和condition参数是那些可以调用browser通过提供相同。他们可以检索用户一旦浏览器已经进入,并提供了一种机制,以允许用户识别已被激活的断点。


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


debug(fun, text="", condition=NULL)
debugonce(fun, text="", condition=NULL)
undebug(fun)
isdebugged(fun)



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

参数:fun
any interpreted R function.
任何解释R函数。


参数:text
a text string that can be retrieved when the browser is entered.
进入浏览器时,可检索的文本字符串。


参数:condition
a condition that can be retrieved when the browser is entered.
当浏览器进入一个可检索的条件。


Details

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

When a function flagged for debugging is entered, normal execution is suspended and the body of function is executed one statement at a time.  A new browser context is initiated for each step (and the previous one destroyed).
当输入标记的调试功能,暂停和身体的功能是在一次执行一个语句正常执行。启动一个新的浏览器上下文的每一步(与前一个破坏)。

At the debug prompt the user can enter commands or R expressions, followed by a newline.  The commands are
在调试,提示用户可以输入命令或R的表达,一个换行符。命令是:




n (or just an empty line, by default).
n(或只是一个空行,默认情况下)。




c continue to the end of the current context: e.g. to the
c继续在目前的情况下结束,例如:到




cont synonym for c.
contc的代名词。




where print a stack trace of all active function calls.
where打印所有活跃的函数调用堆栈跟踪。




Q exit the browser and the current evaluation and
Q退出浏览器和当前的评价和

(Leading and trailing whitespace is ignored, except for an empty line).
(领导和结尾的空白将被忽略,除了一个空行)。

Anything else entered at the debug prompt is interpreted as an R expression to be evaluated in the calling environment: in particular typing an object name will cause the object to be printed, and ls() lists the objects in the calling frame.  (If you want to look at an object with a name such as n, print it explicitly.)
在调试提示符下输入的任何东西被解释为R的表达,在调用环境评估对象的名称,尤其是打字会导致要打印的对象,和ls()列出了在调用框架对象。 (如果你想看看在同一个名字n对象,它明确地打印。)

Setting option "browserNLdisabled" to TRUE disables the use of an empty line as a synonym for n.  If this is done, the user will be re-prompted for input until a valid command or an expression is entered.
设置选项"browserNLdisabled"TRUE禁用n使用一个空行的代名词。如果这样做,用户将被重新提示输入,直到输入一个有效的命令或表达。

To debug a function is defined inside a function, single-step though to the end of its definition, and then call debug on its name.
为了调试一个函数定义一个函数内部,单步,但其定义,然后调用debug它的名字。

If you want to debug a function not starting at the very beginning, use trace(..., at = *) or setBreakpoint.
如果你想调试功能,在一开始就没有开始,使用trace(..., at = *)或setBreakpoint。

Using debug is persistent, and unless debugging is turned off the debugger will be entered on every invocation (note that if the function is removed and replaced the debug state is not preserved). Use debugonce to enter the debugger only the next time the function is invoked.
使用debug是持久的,除非关闭调试,调试器将输入每次调用(注意,如果被拆除,取而代之的功能调试状态是不保留)。使用debugonce进入调试只有在下一次函数被调用。

In order to debug S4 methods (see Methods), you need to use trace, typically calling browser, e.g., as <br> trace("plot", browser, exit=browser, signature = c("track", "missing"))
为了调试(看到Methods),您需要使用trace,通常调用browser作为参考,例如,trace("plot", browser, exit=browser, signature = c("track", "missing"))S4方法

The number of lines printed for the deparsed call when a function is entered for debugging can be limited by setting options(deparse.max.lines).
通话时进入调试函数deparsed印刷线数可以限制通过设置options(deparse.max.lines)。


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

browser, trace; traceback to see the stack after an Error: ... message; recover for another debugging approach.
browser,trace;tracebackError: ...消息后的堆栈;recover另一个调试的方法。

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-24 11:33 , Processed in 0.022800 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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