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

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

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

                                         Compute an Adjacency Matrix for Superclasses of Class Definitions
                                         超类的类定义计算的邻接矩阵

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

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

Given a vector of class names or a list of class definitions, the function returns an adjacency matrix of the superclasses of these classes; that is, a matrix with class names as the row and column names and with element [i, j] being 1 if the class in column j is a direct superclass of the class in row i, and 0 otherwise.
鉴于向量类名或类定义的列表,该函数返回这些类的超类的邻接矩阵;是,行和列名的类名和元素的矩阵[I,J] 1如果在第j列的类是直接超类的一个i行,否则为0。

The matrix has the information implied by the contains slot of the class definitions, but in a form that is often more convenient for further analysis; for example, an adjacency matrix is used in packages and other software to construct graph representations of relationships.
矩阵contains类定义的槽隐含的信息,但邻接矩阵的形式,往往是更方便作进一步的分析,例如,在包和其他软件用于构建图形表示的关系。


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


classesToAM(classes, includeSubclasses = FALSE,
       abbreviate = 2)



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

参数:classes
Either a character vector of class names or a list, whose elements can be either class names or class definitions.  The list is convenient, for example, to include the package slot for the class name. See the examples.  
无论是特征向量的类名或一个列表,其元素可以是类名或类定义。这份名单是方便,例如,包括包类的名称槽。见的例子。


参数:includeSubclasses
A logical flag; if TRUE, then the matrix will include all the known subclasses of the specified classes as well as the superclasses.  The argument can also be a logical vector of the same length as classes, to include subclasses for some but not all the classes.  
一个逻辑标志;如果TRUE,然后矩阵将包括所有已知的指定类的子类以及父类。参数也可以是相同的长度为classes逻辑的向量,包括一些,但并非所有的类的子类。


参数:abbreviate
Control of the abbreviation of the row and/or  column labels of the matrix returned: values 0, 1, 2, or 3 abbreviate neither, rows, columns or both.  The default, 2, is useful for printing the matrix, since class names tend to be more than one character long, making for spread-out printing.  Values of 0 or 3 would be appropriate for making a graph (3 avoids the tendency of some graph plotting software to produce labels in minuscule font size).  
控制行和/或矩阵的列标签的缩写返回值0,1,2或3缩写既不行,列或两者兼而有之。 2,默认情况下,打印矩阵是有用的,因为类名往往是多个字符长,扩印刷。 0或3的值将是适当的图形(3避免了一些图绘制软件的倾向,产生微小的字体大小的标签)。


Details

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

For each of the classes, the calculation gets all the superclass names from the class definition, and finds the edges in those classes' definitions; that is, all the superclasses at distance 1.  The corresponding elements of the adjacency matrix are set to 1.
对于每个类,计算得到的类定义的所有父类的名称,并认为在这些类中定义的边缘,也就是说,所有的父在距离1。邻接矩阵相应元素都设置为1。

The adjacency matrices for the individual class definitions are merged.  Note two possible kinds of inconsistency, neither of which should cause problems except possibly with identically named classes from different packages.  Edges are computed from each superclass definition, so that information overrides a possible inference from extension elements with distance > 1 (and it should).  When matrices from successive classes in the argument are merged, the computations do not currently check for inconsistencies—this is the area where possible multiple classes with the same name could cause confusion.  A later revision may include consistency checks.
被合并为单个的类定义的邻接矩阵。请注意两个可能的不一致,既不应引起问题,可能从不同的包名称相同的类除外。边缘计算从每个超类定义,从而使信息覆盖从距离> 1(并且应该)扩展元素可能推断。当连续类在参数矩阵合并,不计算目前检查不一致,这是该区域可能具有相同名称的多个类可能会导致混乱。以后的修订版可能包括一致性检查。


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

As described, a matrix with entries 0 or 1, non-zero values indicating that the class corresponding to the column is a direct superclass of the class corresponding to the row.  The row and column names are the class names (without package slot).
如上所述,一个0或1项,非零值的矩阵表示列相应的类的直接超类的相应行。行和列名的类名(不包槽)。


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

extends and classRepresentation for the underlying information from the class definition.
extendsclassRepresentation从类定义的基本信息。


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



## the super- and subclasses of "standardGeneric"[#的“standardGeneric”的超和子]
## and "derivedDefaultMethod"[#“derivedDefaultMethod”]
am <- classesToAM(list(class(show), class(getMethod(show))), TRUE)
am

## Not run: [#无法运行:]
## the following function depends on the Bioconductor package Rgraphviz[#以下功能上Bioconductor包Rgraphviz的取决于]
plotInheritance <- function(classes, subclasses = FALSE, ...) {
    if(!require("Rgraphviz", quietly=TRUE))
      stop("Only implemented if Rgraphviz is available")
    mm <- classesToAM(classes, subclasses)
    classes <- rownames(mm); rownames(mm) <- colnames(mm)
    graph <-  new("graphAM", mm, "directed", ...)
    plot(graph)
    cat("Key:\n", paste(abbreviate(classes), " = ", classes, ", ",
        sep = ""),  sep = "", fill = TRUE)
    invisible(graph)
}

## The plot of the class inheritance of the package "graph"[#剧情类继承包“图”]
require(graph)
plotInheritance(getClasses("package:graph"))


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

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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-24 20:59 , Processed in 0.033251 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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