findClass(methods)
findClass()所属R语言包:methods
Computations with Classes
带类的计算
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Functions to find and manipulate class definitions.
发现和处理类定义的函数。
用法----------Usage----------
removeClass(Class, where)
isClass(Class, formal=TRUE, where)
getClasses(where, inherits = missing(where))
findClass(Class, where, unique = "")
resetClass(Class, classDef, where)
sealClass(Class, where)
参数----------Arguments----------
参数:Class
character string name for the class. The functions will usually take a class definition instead of the string. To restrict the class to those defined in a particular package, set the packageSlot of the character string.
字符类的字符串名称。的功能,通常会采取类的定义,而不是字符串。要限制在一个特定的包中定义的类,设置字符串packageSlot,。
参数:where
the environment in which to modify or remove the definition. Defaults to the top-level environment of the calling function (the global environment for ordinary computations, but the environment or namespace of a package in the source for a package). When searching for class definitions, where defines where to do the search, and the default is to search from the top-level environment or namespace of the caller to this function.
environment在其中修改或删除的定义。默认调用函数(普通计算的全球环境,但一个包一个包的源环境或命名空间)的顶级环境。搜索类定义时,where定义在哪里做的搜索,默认是搜索从顶层的环境,或打电话到这个函数的命名空间。
参数:unique
if findClass expects a unique location for the class, unique is a character string explaining the purpose of the search (and is used in warning and error messages). By default, multiple locations are possible and the function always returns a list.
如果findClass预计为类独特的地理位置,unique是一个字符串解释搜查的目的(用于警告和错误消息)。默认情况下,多个地点是可能的,函数总是返回一个列表。
参数:inherits
in a call to getClasses, should the value returned include all parent environments of where, or that environment only? Defaults to TRUE if where is omitted, and to FALSE otherwise.
调用getClasses在,应返回值where,或者说,环境只包括所有母公司环境?默认为TRUE如果where被省略,FALSE否则。
参数:formal
Should a formal definition be required?
应该需要一个正式的定义?
参数:classDef
For removeClass, the optional class definition (but usually it's better for Class to be the class definition, and to omit classDef).
removeClass,可选的类定义(但通常是更好的Class是类的定义,省略classDef)。
Details
详情----------Details----------
These are the functions that test and manipulate formal class definitions. Brief documentation is provided below. See the references for an introduction and for more details.
这些都是功能测试和操纵正式的类定义。下面提供了简短的文件。为引进更多细节,请参阅的参考。
Remove the definition of this class, from the environment where if this argument is supplied; if not, removeClass will search for a definition, starting in the top-level environment of the call to removeClass, and remove the (first) definition found.
删除这个类的定义,从环境where如果这种说法提供,如果没有,removeClass将搜索定义,开始在调用removeClass的顶级环境,并删除(一)定义的发现。
Is this the name of a formally defined class? (Argument formal is for compatibility and is ignored.)
这是一个正式定义的类的名称吗? (参数formal是兼容性和被忽略。)
The names of all the classes formally defined on where. If called with no argument, all the classes visible from the calling function (if called from the top-level, all the classes in any of the environments on the search list). The inherits argument can be used to search a particular environment and all its parents, but usually the default setting is what you want.
where正式定义的所有类的名称。如果不带参数调用,调用函数(如果从顶层,在搜索列表中的任何环境中的所有类调用)从可见的所有类。 inherits参数,可以用来搜索一个特定的环境和其所有的父母,但通常的默认设置是你想要什么。
The list of environments or positions on the search list in which a class definition of Class is found. If where is supplied, this is an environment (or namespace) from which the search takes place; otherwise the top-level environment of the caller is used. If unique is supplied as a character string, findClass returns a single environment or position. By default, it always returns a list. The calling function should select, say, the first element as a position or environment for functions such as get.
搜索列表,在其中发现类定义了Class环境或位置的列表。如果where提供,这是一个环境(或命名空间)从搜索发生,否则使用呼叫者的顶级环境。如果unique提供字符串,findClass返回一个单一的环境或位置。默认情况下,它总是返回一个列表。调用函数应该选择,比方说,作为第一个元素的位置或环境的功能,如get。
If unique is supplied as a character string, findClass will warn if there is more than one definition visible (using the string to identify the purpose of the call), and will generate an error if no definition can be found.
如果unique提供字符串,findClass会发出警告,如果有一个以上定义可见(使用字符串来确定呼叫的目的),并且会产生一个错误,如果没有定义被发现。
Reset the internal definition of a class. Causes the complete definition of the class to be re-computed, from the representation and superclasses specified in the original call to setClass.
重置一个类的内部定义。导致完整的定义,从原来的呼叫setClass指定的代表性和父类是重新计算。
This function is called when aspects of the class definition are changed. You would need to call it explicitly if you changed the definition of a class that this class extends (but doing that in the middle of a session is living dangerously, since it may invalidate existing objects).
这个函数被调用时类定义的各个方面都改变了。你需要把它明确如果你改变一个类的定义,这个类扩展(但是这样做,在会议中间居住的危险,因为它可能会使现有的对象)。
sealClass: Seal the current definition of the specified class, to prevent further changes. It is possible to seal a class in the call to setClass, but sometimes further changes have to be made (e.g., by calls to setIs). If so, call sealClass after all the relevant changes have been made.
sealClass:密封目前指定的类的定义,以防止进一步的变化。这是可能的密封类在调用setClass,但有时进一步的变化(如由调用setIs的)。如果是的话,叫sealClass后已作出所有有关的变化。
参考文献----------References----------
Software for Data Analysis: Programming with R Springer. (For the R version.)
Programming with Data Springer (For the original S4 version.)
参见----------See Also----------
setClassUnion, Methods, makeClassRepresentation
setClassUnion,Methods,makeClassRepresentation
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|