View source: R/wrangle-structure.R
| rename_nodes | R Documentation |
Rename Nodes
rename_nodes(x, from, to = NULL, keep_format = FALSE, directed = NULL)
x |
Network input. |
from |
Character vector of current labels, or a named character vector
mapping old label to new (in which case |
to |
Character vector of new labels, the same length as |
keep_format |
Logical. Return the input format when TRUE. |
directed |
Logical or NULL. If NULL (default), auto-detect. |
A cograph_network with the renamed nodes, or the input format
when keep_format = TRUE. Labels not named in from are left
alone.
reorder_nodes, set_nodes
adj <- matrix(c(0, 1, 1, 0), 2, 2)
rownames(adj) <- colnames(adj) <- c("A", "B")
get_labels(rename_nodes(adj, from = "A", to = "Alpha"))
get_labels(rename_nodes(adj, from = c(A = "Alpha", B = "Beta")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.