Description Details Objects from the Class Slots Methods Author(s) References Examples
S4 class.
As the gRapHD class does not use variables names, but only the column
indexes in the dataset, the conversion may change the variables references. When
converting a gRapHD
object to a graphNEL
object, the nodes
names in the new object are only the original indexes converted to character.
When doing the reverse conversion, the nodes indexes in the new
gRapHD
object are the respective indexes in the original element
nodes
in the graphNEL
object. See the example below.
Objects can be created, for example, by new("gRapHD", ...)
.
Where ...
may contain the initial attribute names and values, as
described in the Slots section.
edges
:integer, matrix with 2 columns, each row representing one edges and each column one of the vertices in the edge. Column 1 containsthe vertex with lower index.
homog
:logical, TRUE if the covariance is homogeneous.
minForest
:integer, first and last edges found with minForest.
numCat
:integer, vector with number of levels for each variable (0 if continuous).
numP
:integer, vector with number of estimated parameters for each edge.
p
:integer, number of variables (vertices) in the model.
stat.minForest
:character, measure used (LR, AIC, or BIC).
stat.stepw
:character, measure used (LR, AIC, or BIC).
stat.user
:character, user defined.
statSeq
:numeric, vector with value of stat.minForest for each edge.
stepw
:interger, first and last edges found with stepw.
userDef
:integer, first and last edges defined by the user.
vertNames
:character, vector with vertices' names.
setMethod("initialize","gRapHD",initialize.gRapHD)
setMethod("summary",signature(object="gRapHD"),summary.gRapHD)
setMethod("print",signature(x="gRapHD"),print.gRapHD)
setMethod("show",signature(object="gRapHD"),show.gRapHD)
setMethod("plot",signature(x="gRapHD"),plot.gRapHD)
setAs(from="matrix",to="gRapHD",def=matrix.gRapHD)
setAs(from="gRapHD",to="graphNEL",def=gRapHD.graphNEL)
setAs(from="graphNEL",to="gRapHD",def=graphNEL.gRapHD)
Gabriel Coelho Goncalves de Abreu (abreu_ga@yahoo.com.br)
David Edwards (David.Edwards@agrsci.dk)
R. Gentleman, Elizabeth Whalen, W. Huber and S. Falcon. graph: A package to handle graph data structures. R package version 1.22.2.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # convertion from gRapHD to graphNEL
edges <- matrix(c(1,2,1,3,1,4),,2,byrow=TRUE)
g <- as(edges,"gRapHD")
#List of 9
# $ edges : num [1:3, 1:2] 1 1 1 2 3 4
# $ p : int 4
# $ stat.user: chr "LR"
# $ statSeq : num [1:3] NA NA NA
# $ varType : int [1:4] 0 0 0 0
# $ numCat : int [1:4] 0 0 0 0
# $ homog : logi TRUE
# $ numP : num [1:3] NA NA NA
# $ userDef : num [1:2] 1 3
# - attr(*, "class")= chr "gRapHD"
g1 <- as(g,"graphNEL")
# A graphNEL graph with undirected edges
# Number of Nodes = 4
# Number of Edges = 3
g1@nodes # the nodes names
as(matrix(integer(0),,2),"gRapHD")
# note that the vertices must be numbered consecutively from 1. In the
# following, vertex 2 is added as an isolated vertex.
m1 <- as(matrix(c(1,3,1,4),,2,byrow=TRUE),"gRapHD")
## Not run: plot(m1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.