mapGraph | R Documentation |
The function insert additional nodes to a graph object.
Among the node types, additional source or sink nodes can be added.
Regarding the former, source nodes can represent: (i) data variables;
(ii) a group variable; (iii) Latent Variables (LV). For the latter,
sink nodes represent the levels of a categorical outcome variable and
are linked with all graph nodes.' Moreover, mapGraph()
can also
create a new graph object starting from a compact symbolic formula.
mapGraph(graph, type, C = NULL, LV = NULL, f = NULL, verbose = FALSE, ...)
graph |
An igraph object. |
type |
A character value specifying the type of mapping. Five types can be specified.
|
C |
the number of labels of the categorical sink node (default = NULL). |
LV |
The number of LV source nodes to add to the graph. This argument
needs to be specified when |
f |
A formula object (default = NULL). A new graph object is created according to the specified formula object. |
verbose |
If TRUE disply the mapped graph (default = FALSE) |
... |
Currently ignored. |
mapGraph returns invisibly the graphical object with the mapped node variables.
Mario Grassi mario.grassi@unipv.it
# Load Amyotrophic Lateral Sclerosis (ALS)
ig<- alsData$graph; gplot(ig)
# ... map source nodes to sink nodes of ALS graph
ig1 <- mapGraph(ig, type = "source"); gplot(ig1, l="dot")
# ... map group source node to ALS graph
ig2 <- mapGraph(ig, type = "group"); gplot(ig2, l="fdp")
# ... map outcome sink (C=2) to ALS graph
ig3 <- mapGraph(ig, type = "outcome", C=2); gplot(ig3, l="fdp")
# ... map LV source nodes to ALS graph
ig4 <- mapGraph(ig, type = "LV", LV = 3); gplot(ig4, l="fdp")
# ... map LV source nodes to the cluster nodes of ALS graph
ig5 <- mapGraph(ig, type = "clusterLV"); gplot(ig5, l="dot")
# ... create a new graph with the formula variables
formula <- as.formula("z4747 ~ z1432 + z5603 + z5630")
ig6 <- mapGraph(f=formula); gplot(ig6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.