findMethods(methods)
findMethods()所属R语言包:methods
Description of the Methods Defined for a Generic Function
一个泛型函数中定义的方法说明
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The function findMethods converts the methods defined in a table for a generic function (as used for selection of methods) into a list, for study or display. The list is actually from the class listOfMethods (see the section describing the class, below).
功能findMethods转换表中定义一个泛型函数(如选择使用方法)研究或显示成一个列表的方法。该名单实际上是类listOfMethods(见描述类,下面的部分)。
The list will be limited to the methods defined in environment where if that argument is supplied and limited to those including one or more of the specified classes in the method signature if that argument is supplied.
名单将有限的环境中定义的方法where如果这样的说法提供,并仅限于那些包括一个或多个指定的classes在方法签名中,如果这样的说法提供。
To see the actual table (an environment) used for methods dispatch, call getMethodsForDispatch. The names of the list returned by findMethods are the names of the objects in the table.
要看到实际的表(环境)使用的方法调度,调用getMethodsForDispatch。名单上的名字返回findMethods表中的对象的名称。
The function findMethodSignatures returns a character matrix whose rows are the class names from the signature of the corresponding methods; it operates either from a list returned by findMethods, or by computing such a list itself, given the same arguments as findMethods .
功能findMethodSignatures返回一个字符矩阵,其行是从相应的方法签名的类名,它无论是从findMethods返回列表,或通过计算这样一个列表本身运作,给予同样的findMethods的论点。
The function hasMethods returns TRUE or FALSE according to whether there is a non-empty table of methods for function f in the environment or search position where (or for the generic function generally if where is missing).
函数hasMethods返回TRUE或FALSE根据功能的方法是否有一个非空表f环境中或搜索位置where(一般通用功能where失踪)。
The deprecated function getMethods is an older alternative to findMethods , returning information in the form of an object of class MethodsList, previously used for method dispatch. It is not recommended, since this class of objects is deprecated generally and will disappear in a future version of R.
过时的功能getMethods是一个旧的findMethods,返回的信息在一个类的对象的形式替代MethodsList,以前使用方法调度。这是不建议,因为这一类的对象是一般不赞成将消失,在未来版本的河
用法----------Usage----------
findMethods(f, where, classes = character(), inherited = FALSE,
package = "")
findMethodSignatures(..., target = TRUE, methods = )
hasMethods(f, where, package)
### DEPRECATED
getMethods(f, where, table = FALSE)
参数----------Arguments----------
参数:f
A generic function or the character-string name of one.
一个泛型函数或一个字符的字符串名称。
参数:where
Optionally, an environment or position on the search list to look for methods metadata. If where is missing, findMethods uses the current table of methods in the generic function itself, and hasMethods looks for metadata anywhere in the search list.
可选的搜索列表中的位置,环境或寻找方法的元数据。 where如果缺少,findMethods使用当前表的通用功能本身的方法,hasMethods看起来元数据在搜索列表中的任何地方。
参数:table
If TRUE in a call to getMethods the returned value is the table used for dispatch, including inherited methods discovered to date. Used internally, but since the default result is the now unused mlist object, the default will likely be changed at some point.
如果TRUE在通话getMethods返回的值是调度使用的表,包括迄今发现的继承的方法。内部使用,但由于默认的结果是,现在未使用的mlist对象,将有可能在某种程度上改变默认。
参数:classes
If supplied, only methods whose signatures contain at least one of the supplied classes will be included in the value returned.
如果提供的,唯一的方法,其签名至少包含所提供的类将包括在返回值。
参数:inherited
Logical flag; if TRUE, the table of all methods, inherited or defined directly, will be used; otherwise, only the methods explicitly defined. Option TRUE is meaningful only if where is missing.
逻辑标志;如果TRUE,表的所有方法,继承或直接定义,将被使用,否则,唯一的方法明确界定。选项TRUE是有意义where只有失踪。
参数:...
In the call to findMethodSignatures, any arguments that might be given to findMethods.
在呼叫findMethodSignatures,任何可能给findMethods的论点。
参数:target
Optional flag to findMethodSignatures; if TRUE, the signatures used are the target signatures (the classes for which the method will be selected); if FALSE, they will be the signatures are defined. The difference is only meaningful if inherited is TRUE.
可选标志findMethodSignatures;TRUE,使用签名的目标签名(类)的方法将选择;如果FALSE,他们将签名的定义。不同的是唯一有意义的inherited如果是TRUE。
参数:methods
In the call to findMethodSignatures, an optional list of methods, presumably returned by a previous call to findMethods. If missing, that function will be call with the ... arguments.
在调用findMethodSignatures,可选列表的方法,想必以前调用返回findMethods。如果丢失,该函数将调用...参数。
参数:package
In a call to hasMethods, the package name for the generic function (e.g., "base" for primitives). If missing this will be inferred either from the "package" attribute of the function name, if any, or from the package slot of the generic function. See "Details".
调用hasMethods在,通用功能软件包的名称(例如,"base"原语)。如果缺少这将推断,无论是从"package"属性的函数的名称,如果有的话,或从包槽的通用功能。见“详细资料”。
Details
详情----------Details----------
The functions obtain a table of the defined methods, either from the generic function or from the stored metadata object in the environment specified by where. In a call to getMethods, the information in the table is converted as described above to produce the returned value, except with the table argument.
功能获得一个表中定义的方法,无论是从通用功能或从在where指定的环境中存储的元数据对象。在getMethods,表中的信息转换如上所述生产除了table参数,返回值的调用。
Note that hasMethods, but not the other functions, can be used even if no generic function of this name is currently found. In this case package must either be supplied as an argument or included as an attribute of f, since the package name is part of the identification of the methods tables.
注意hasMethods,而不是其他功能,可以使用,即使没有这个名字的通用功能,是目前发现的。在这种情况下package必须提供作为参数或属性f,因为包的名称是识别的方法表的一部分。
类的方法列表----------The Class for lists of methods----------
The class "listOfMethods" returns the methods as a named list of method definitions (or a primitive function, see the slot documentation below). The names are the strings used to store the corresponding objects in the environment from which method dispatch is computed. The current implementation uses the names of the corresponding classes in the method signature, separated by "#" if more than one argument is involved in the signature.
类"listOfMethods"返回的方法定义命名列表(或原始的功能,请参阅下面的插槽文档)的方法。的名称是用于存储在相应的对象,方法调度计算环境中的字符串。当前实现使用在方法签名中相应的类的名称,分隔"#"如果在签名涉及多个参数。
插槽----------Slots----------
.Data: Object of class "list" The method definitions.
.Data类"list"方法定义的对象。
Note that these may include the primitive function itself as default method, when the generic corresponds to a primitive. (Basically, because primitive functions are abnormal R objects, which cannot currently be extended as method definitions.) Computations that use the returned list to derive other information need to take account of this possibility. See the implementation of findMethodSignatures for an example.
请注意,这些可能包括作为默认的方法本身的原始功能,当通用对应到原始。 (基本上,因为原始功能异常的R对象,而目前不能延长方法定义。)计算,使用返回的列表获得其他信息需要采取这种可能性的帐户。看到一个例子执行findMethodSignatures。
arguments: Object of class "character". The
arguments类"character"的对象。 “
signatures: Object of class "list". A list of the signatures of the individual methods. This is currently the result of splitting the names according to the "#" separator.
signatures类"list"的对象。的单个方法的签名名单。这是目前分裂的结果names"#"分隔。
If the object has been constructed from a table, as when returned by findMethods, the signatures will all have the same length. However, a list rather than a character matrix is used for generality. Calling findMethodSignatures as in the example
如果对象已建成从一个表,作为由findMethods返回时,签名将所有具有相同的长度。然而,列表,而不是一个字符矩阵用于一般性。调用findMethodSignatures的例子
generic: Object of class "genericFunction". The generic function corresponding to these methods. There
generic类"genericFunction"的对象。这些方法对应的通用功能。那里
names: Object of class "character". The
names类"character"的对象。 “
延伸----------Extends----------
Class "namedList", directly.
类"namedList",直接。
Class "list", by class "namedList", distance 2.
类"list"类"namedList",距离2。
Class "vector", by class "namedList", distance 3.
类"vector"类"namedList",距离3。
参见----------See Also----------
showMethods, selectMethod, Methods
showMethods,selectMethod,方法
举例----------Examples----------
mm <- findMethods("Ops")
findMethodSignatures(methods = mm)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|