View source: R/class-network.R
| get_nodes | R Documentation |
These functions read and replace the parts of a cograph_network
object created by as_cograph. The getters return the node
table, the edge table, the node labels, the node groups, the source type,
the stored estimation data, the metadata list, and the counts of nodes and
edges. The setters return a modified copy of the network.
get_nodes(x)
get_edges(x)
get_labels(x)
get_source(x)
get_data(x)
get_meta(x)
set_nodes(x, nodes_df)
set_edges(x, edges_df)
set_layout(x, layout_df)
set_groups(
x,
groups = NULL,
type = c("group", "cluster", "layer"),
nodes = NULL,
layers = NULL,
clusters = NULL
)
get_groups(x)
nodes(x)
is_directed(x)
n_nodes(x)
n_edges(x)
x |
A |
nodes_df |
A data frame of node information. A missing |
edges_df |
A data frame with columns |
layout_df |
A data frame with |
groups |
Node groupings in one of these formats:
|
type |
Group type stored by |
nodes |
Character vector of node labels, used with |
layers |
Character or factor vector of layer assignments, the same
length as |
clusters |
Character or factor vector of cluster assignments, the same
length as |
get_nodes(), nodes()The node table, with id
and label columns plus layout coordinates or other metadata
columns when present. nodes() is a deprecated alias of
get_nodes() and signals a deprecation warning.
get_edges()A data frame with one row per edge and columns
from and to (integer row numbers into the node table),
weight, and any extra edge columns. An undirected network stores
one row per unordered pair. as.data.frame()
returns the same table with node labels as endpoints.
get_labels()A character vector of node labels.
get_groups()A data frame with a node column and one
of layer, cluster or group, or NULL when no
groups are set.
get_source()A character string naming the input type (for
example "matrix", "tna", "igraph",
"edgelist"), or "unknown".
get_data()The original estimation data (for example the
sequence data of a tna model), or NULL when none is stored.
get_meta()A list with component source (input
type). Networks built from a tna model also carry tna (type,
group name and group index).
n_nodes(), n_edges()An integer count. Each undirected edge counts once.
is_directed()A single logical value.
set_nodes(), set_edges(), set_layout(),
set_groups()The modified cograph_network.
set_layout() writes the coordinates into the x and
y columns of the node table. set_groups() stores the
grouping as node_groups for use by the group-aware plot
functions. It stops with an error when a node is assigned twice, when
a node is missing from the assignment or unknown to the network, and
when fewer than two groups result. set_edges() raises an error
of class cograph_bad_selection for endpoints outside the node
table and for duplicated edges.
as_cograph, splot,
detect_communities
net <- as_cograph(regulation_net)
get_edges(net)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.