class2Graph | R Documentation |
From an S4 class definition class
, computes the graph of all
super classes, i.e., of all classes that class
extends.
class2Graph(class, fullNames = TRUE, simpleOnly = FALSE,
bottomUp = FALSE, package = class@package)
class |
class name |
fullNames |
logical indicating if full name should be applied.... |
simpleOnly |
logical, simply passed to
|
bottomUp |
logical indicating the direction of the graph. |
package |
package where the super classes should be gotten from. |
an R object inheriting from class graph
.
Robert Gentleman (original code) and Martin Maechler
classTree
which builds the graph of all
subclasses.
require("graph")
cg <- class2Graph("graphNEL") # simple : graphNEL |-> graph
plot(cg)
if(require("Matrix")) {
cg2 <- class2Graph("dgCMatrix")
as(cg2, "sparseMatrix")
plot(cg2)
## alternative: don't show the initial "Matrix:"
cg2. <- class2Graph("dgCMatrix", fullNames=FALSE)
plot(cg2.)
## 'simpleOnly' does not change anything here :
stopifnot(identical(cg2.,
class2Graph("dgCMatrix", fullNames=FALSE, simpleOnly = TRUE)))
## very simple, since "sparseMatrix" only extends "Matrix" :
cg3 <- class2Graph("sparseMatrix")
plot(cg3)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.