Learn R Programming

cograph (version 2.0.0)

to_network: Convert Network to statnet network Object

Description

Converts any supported network format to a statnet network object.

Usage

to_network(x, directed = NULL)

Value

A network object from the network package.

Arguments

x

Network input: matrix, cograph_network, igraph, tna, etc.

directed

Logical or NULL. If NULL (default), auto-detect from input.

See Also

to_igraph, to_matrix, to_df, as_cograph

Examples

Run this code
if (requireNamespace("network", quietly = TRUE)) {
  adj <- matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), 3, 3)
  rownames(adj) <- colnames(adj) <- c("A", "B", "C")
  net <- to_network(adj)
}

Run the code above in your browser using DataLab