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

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

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

                                         Test for and Report about  Selection of Inherited Methods
                                         试验报告和有关继承方法的选择

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

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

A set of distinct inherited signatures is generated to test inheritance for all the methods of a specified generic function.  If method selection is ambiguous for some of these, a summary of the ambiguities is attached to the returned object.  This test should be performed by package authors before releasing a package.
生成一个不同继承签名的一套测试指定的通用功能的所有方法的继承。如果方法的选择是对其中一些暧昧的,含糊的总结是返回的对象。应执行此测试包作家之前释放包。


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


testInheritedMethods(f, signatures, test = TRUE, virtual = FALSE,
                     groupMethods = TRUE, where = .GlobalEnv)



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

参数:f
a generic function or the character string name of one.  By default, all currently defined subclasses of all the method signatures for this generic will be examined.  The other arguments are mainly options to modify which inheritance patterns will be examined.  
一个泛型函数或一个字符串名称。默认情况下,所有当前定义的所有方法签名这个通用的子类将被审查。其他参数,主要是继承模式将审查修改的选项。


参数:signatures
An optional set of subclass signatures to use instead of the relevant subclasses computed by testInheritedMethods.  See the Details for how this is done.  This argument might be supplied after a call with test = FALSE, to test selection in batches.  
一个可选的子类,而不是使用计算testInheritedMethods的有关子类的签名。看到这是如何做到的细节。这种说法可能会提供后test = FALSE,测试分批选拔的呼叫。


参数:test
optional flag to control whether method selection is actually tested. If FALSE, returns just the list of relevant signatures for subclasses, without calling selectMethod for each signature. If there are a very large number of signatures, you may want to collect the full list  and then test them in batches.  
可选的标志,以控制是否实际测试方法的选择。如果FALSE,返回子类相关的签名,只是没有调用selectMethod每个签名列表。如果有一个非常大的数字签名,您可能要收集完整的列表,然后分批进行测试。


参数:virtual
should virtual classes be included in the relevant subclasses. Normally not, since only the classes of actual arguments will trigger the inheritance calculation in a call to the generic function. Including virtual classes may be useful if the class has no current non-virtual subclasses but you anticipate your users may define such classes in the future.  
虚拟教室应包括在有关小类。通常不会,因为只有实际参数的类将触发调用泛型函数的继承计算。包括虚拟类可能是有用的,如果类目前尚无非虚子类,但你预计你的用户可能会在未来的定义,这样的类。


参数:groupMethods
should methods for the group generic function be included?  
组通用功能的方法应该被列入?


参数:where
the environment in which to look for class definitions.  Nearly always, use the default global environment after attaching all the packages with relevant methods and/or class definitions.  
的环境中寻找类定义。几乎总是附加相关的方法和/或类定义的所有的包,使用后,默认的全球环境。


Details

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

The following description applies when the optional arguments are omitted, the usual case. First, the defining signatures for all methods are computed by calls to findMethodSignatures. From these all the known non-virtual subclasses are found for each class that appears in the signature of some method. These subclasses are split into groups according to which class they inherit from, and only one subclass from each group is retained (for each argument in the generic signature). So if a method was defined with class "vector" for some argument, one actual vector class is chosen arbitrarily. The case of "ANY" is dealt with specially, since all classes extend it.  A dummy, nonvirtual class, ".Other", is used to correspond to all classes that have no superclasses among those being tested.
下面的说明适用于可选参数被省略时,通常情况下。首先,定义的所有方法的签名,计算电话findMethodSignatures。所有已知的非虚子类,从这些发现为每个类中出现的一些方法的签名。这些子类是根据他们继承哪个类分成组,并保留每个组只有一个子类(每个参数在通用的签名)。因此,如果一个方法被定义的类"vector"一些参数,一个实际的向量类任意选择。 "ANY"与特殊处理,因为所有的类扩展它。一个虚拟的,非虚类,".Other",用来对应所有在被测试者没有父类。

All combinations of retained subclasses for the arguments in the generic signature are then computed. Each row of the resulting matrix is a signature to be tested by a call to selectMethod. To collect information on ambiguous selections, testInheritedMethods establishes a calling handler for the special signal "ambiguousMethodSelection", by setting the corresponding option.
在通用签名的论点保留的子类的所有组合,然后计算。矩阵的每一行是一个测试调用selectMethod一个签名。要对含糊选择的信息收集,testInheritedMethods建立一个特殊的信号处理程序调用"ambiguousMethodSelection",通过设置相应的选项。


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

An object of class "methodSelectionReport".  The details of this class are currently subject to change.  It has slots "target", "selected", "candidates", and "note", all referring to the ambiguous cases (and so of length 0 if there were none).  These slots are intended to be examined by the programmer to detect and preferably fix ambiguous method selections. The object contains in addition slots "generic", the name of the generic function, and "allSelections",  giving the vector of labels for all the signatures tested.
对象类"methodSelectionReport"。这个类的细节目前正在改变。它有槽"target","selected","candidates","note",所有含糊不清的情况下(和这样的长度为0,如果没有这样的)。这些插槽的目的是要由程序员检查,检测和最好解决暧昧的方法选择。对象包含除了插槽"generic",泛型函数的名称,"allSelections",给所有的测试签名的标签的向量。


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

Software for Data Analysis: Programming with R Springer.  (Section 10.6 for basics of method selection.)
Class Inheritance in R http://stat.stanford.edu/~jmc4/classInheritance.pdf (to be submitted to the R Journal).

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


## if no other attached packages have methods for `+` or its group[#如果没有其他附加的软件包有+或组的方法]
## generic functions, this returns a 16 by 2 matrix of selection[#泛型函数,返回选择矩阵2 16]
## patterns (in R 2.9.0)[#模式(ŕ2.9.0)]
testInheritedMethods("+")

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-23 11:57 , Processed in 0.021793 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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