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

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

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

                                        Call the Current Generic Function from a Method
                                         从一个方法调用目前通用的功能

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

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

A call to callGeneric can only appear inside a method definition.  It then results in a call to the current generic function.  The value of that call is the value of callGeneric. While it can be called from any method, it is useful and typically used in methods for group generic functions.
一个callGeneric调用只能出现在一个方法的定义。然后,它会导致在目前通用的功能的调用。这一呼吁的值是值callGeneric。虽然它可以从任何方法,它是有用的,在通用功能组的方法,通常用于。


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


callGeneric(...)



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

参数:...
Optionally, the arguments to the function in its next call.  If no arguments are included in the call to callGeneric, the effect is to call the function with the current arguments. See the detailed description for what this really means.  
或者,在其下一次调用的函数的参数。如果没有给出参数列入callGeneric通话中,效果是调用当前参数的功能。看到这究竟是怎样的详细描述。


Details

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

The name and package of the current generic function is stored in the environment of the method definition object.  This name is looked up and the corresponding function called.
目前通用的函数的名称和包储存在方法定义对象的环境。抬头一看,这个名字是相应的函数调用。

The statement that passing no arguments to callGeneric causes the generic  function to be called with the current arguments is more precisely as follows.  Arguments that were missing in the current call are still missing (remember that "missing" is a valid class in a method signature).  For a formal argument, say x, that appears in the original call, there is a corresponding argument in the generated call equivalent to x = x.  In effect, this means that the generic function sees the same actual arguments, but arguments are evaluated only once.
如下是更准确地传递任何参数callGeneric导致被称为当前参数的泛型函数的声明。在当前通话中缺少的论点是人仍下落不明(记得"missing"是一个有效的方法签名类)。一个正式的说法,说x,出现在原来的呼叫,有一个相应的参数生成的调用相当于x = x。实际上,这意味着,通用功能看到相同的实际参数,但参数是只计算一次。

Using callGeneric with no arguments is prone to creating infinite recursion, unless one of the arguments in the signature has been modified in the current method so that a different method is selected.
使用callGeneric不带任何参数,很容易创造无限递归的,除非在签名的论据之一,已在目前的方法修改,以便选择不同的方法。


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

The value returned by the new call.
返回值新的呼叫。


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

Software for Data Analysis: Programming with R Springer.  (For the R version.)
Programming with Data Springer (For the original S4 version.)

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

GroupGenericFunctions for other information about group generic functions; Methods for the general behavior of method dispatch
GroupGenericFunctions方法一般行为的方法调度有关组通用功能的其他信息;


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


## the method for group generic function Ops[#组通用功能的老年退休金计划的方法]
## for signature( e1="structure", e2="vector")[#签名(E1 =“结构”,E2 =“向量”)]
function (e1, e2)
{
    value <- callGeneric(e1@.Data, e2)
    if (length(value) == length(e1)) {
        e1@.Data <- value
        e1
    }
    else value
}

## For more examples[更多的例子#]
## Not run: [#无法运行:]
showMethods("Ops", includeDefs = TRUE)

## End(Not run)[#结束(不运行)]


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-5-7 13:02 , Processed in 0.022021 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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