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

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

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

                                         Class names including the corresponding package
                                         包括相应的包的类名

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

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

The function className() generates a valid references to a class, including the name of the package containing the class definition.  The object returned, from class "className", is the unambiguous way to refer to a class, for example when calling setMethod, just in case multiple definitions of the class exist.
功能className()生成的一类有效的参考,其中包含类定义的包的名称。返回的对象,从类"className",是明确的方式,是指一个类,例如,当调用setMethod,以防万一类存在多个定义。

Function "multipleClasses" returns information about multiple definitions of classes with the same name from different packages.
功能"multipleClasses"返回多个类定义的信息,从不同的包的名称相同。


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



className(class, package)

multipleClasses(details = FALSE)



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

参数:class, package
The character string name of a class and, optionally, of the package to which it belongs.  If argument package is missing and the class argument has a package slot, that is used  (in particular, passing in an object from class "className" returns itself in this case, but changes the package slot if the second argument is supplied).  If there is no package argument or slot, a definition for the class must exist and will be used to define the package.  If there are multiple definitions, one will be chosen and a warning printed giving the other possibilities.  
一类的字符串名称和(可选),它所属的包。如果参数package丢失class说法有一个包槽,使用(尤其是在传递一个对象类的"className"在这种情况下返回本身,而是改变包如果第二个参数提供的插槽)。如果有没有包参数或插槽,一个类的定义必须存在,并且将用于定义包。如果有多个定义,将选择和警告印给其他的可能性。


参数:details
If FALSE, the default, multipleClasses() returns a character vector of those classes currently known with multiple definitions.  If TRUE, a named list of those class definitions is returned. Each element of the list is itself a list of the corresponding class definitions, with the package names as the names of the list.  Note that identical class definitions will not be considered “multiple” definitions (see the discussion of the details below).  
如果FALSE,默认情况下,multipleClasses()返回一个目前已知有多重定义这些类的特征向量。如果TRUE,这些类定义了一个名为list返回。列表中的每个元素本身就是一个对应的类定义的名单,名单上的名字,包名。请注意,相同的类定义将不被视为“多”的定义(见下面的细节进行讨论)。


Details

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

The table of class definitions used internally can maintain multiple definitions for classes with the same name but coming from different packages. If identical class definitions are encountered, only one class definition is kept; this occurs most often with S3 classes that have been specified in calls to setOldClass.  For true classes, multiple class definitions are unavoidable in general if two packages happen to have used the same name, independently.
内部使用的类定义中的表可以保持多个名称相同但来自不同的包中的类的定义。如果遇到了相同的类定义,只有一个类定义不断发生这种情况最经常与S3类已在指定的调用setOldClass的。对于真正的类,多类的定义是不可避免的,如果两个包碰巧使用相同的名称,独立一般。

Overriding a class definition in another package with the same name deliberately is usually a bad idea. Although R attempts to keep and use the two definitions (as of version 2.14.0), ambiguities are always possible.  It is more sensible to define a new class that extends an existing class but has a different name.
故意覆盖具有相同名称的类定义在另一个包通常是一个坏主意。虽然ŕ试图保持和使用的两种定义(版本2.14.0),含糊之处总有可能。定义一个新的类,扩展现有的类,但有不同的名称,它是更明智的。


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

A call to className() returns an object from class "className".
一个className()调用类"className"返回一个对象。

A call to multipleClasses() returns either a character vector or a named list of class definitions.  In either case, testing the length of the returned value for being greater than 0 is a check for the existence of multiply defined classes.
一个multipleClasses()调用返回一个字符向量或一个类定义的命名名单。在任何情况下,测试比返回值的长度0是一个多重定义的类的存在检查。


类的对象----------Objects from the Class----------

The class "className" extends "character" and has a slot "package", also of class "character".
类"className"延伸"character"“有一个插槽"package"类"character"。


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


## Not run: [#无法运行:]
className("vector") # will be found, from package "methods"[会被发现,从包“方法”]
className("vector", "magic") # OK, even though the class doesn't exist[确定,即使不存在类]


className("An unknown class") # Will cause an error[将导致错误]

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

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-23 09:19 , Processed in 0.033443 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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