View source: R/class-network.R
| as_cograph | R Documentation |
as_cograph() creates a cograph_network object from a matrix,
an edge list, or a network object of another package. to_cograph()
is an alias. The object is a named list that every cograph function
accepts.
as_cograph(x, directed = NULL, simplify = FALSE, ...)
to_cograph(x, directed = NULL, ...)
## S3 method for class 'cograph_network'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
...,
what = c("edges", "nodes")
)
x |
Network input. One of a square numeric weight matrix, a data frame
edge list, an igraph object, a statnet network object, a qgraph object, a
tna object, or an existing |
directed |
Logical. Forces a directed or undirected interpretation.
|
simplify |
Logical or character. If |
... |
Passed from |
row.names |
|
optional |
Logical, as for |
what |
Which table |
A cograph_network prints a short description of its nodes, edges and
source, summary() reports counts and edge weight statistics,
plot() plots it with sn_render, and
as.data.frame() returns its edge or node table.
The accessor and setter functions are documented in get_nodes.
Producer packages may attach plotting hints under meta$splot. The
recognized fields are renderer (the cograph renderer to use),
weight (the edge column or matrix plotted as weight), and
defaults (a named list of renderer arguments). Entries in
defaults are defaults only, and arguments passed to splot
override them. renderer and weight define which view is plotted
and are not overridden by plot arguments.
as_cograph() and to_cograph() return a
cograph_network object, a named list with components:
nodesData frame with id, label, and optional
layout or metadata columns.
edgesData frame with integer from and to
columns (row numbers into nodes), weight, and extra
columns such as session and time for tna input. Repeated
rows of an edge list are kept as separate edges.
directedLogical. Whether the network is directed.
weightsThe n x n weight matrix for matrix and tna input,
or NULL (for example for an edge list).
dataThe original estimation data (sequence data, edge
list), or NULL.
metaMetadata list with source (input type), a
tna entry for tna input (type, group name and group index)
and, optionally, splot (rendering hints read by
splot).
node_groupsOptional data frame of node groupings.
as.data.frame() returns a base data frame. For
what = "edges" it has one row per edge with columns from and
to (node labels), weight, and any extra edge columns the
network carries, such as session or columns computed by
mutate_edges. For what = "nodes" it has one row per
node with the node table columns (id, label, layout
coordinates and any custom columns). to_df returns only
from, to and weight.
get_nodes, splot, to_df
net <- as_cograph(regulation_net)
as.data.frame(net, what = "edges")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.