View source: R/wrangle-weights.R
| binarize | R Documentation |
Replaces every surviving weight with 1, dropping edges at or below the
threshold. The network equivalent of sna::event2dichot().
binarize(
x,
threshold = 0,
absolute = TRUE,
signed = FALSE,
keep_isolates = TRUE,
keep_format = FALSE,
directed = NULL
)
x |
Network input. |
threshold |
Numeric. Edges whose weight exceeds this value are kept and set to 1. Default 0, which keeps every existing edge. |
absolute |
Logical. Compare |
signed |
Logical. If TRUE, negative edges become |
keep_isolates |
Logical. Keep nodes that end up with no edges? Default TRUE. |
keep_format |
Logical. Return the input format when TRUE. |
directed |
Logical or NULL. If NULL (default), auto-detect. |
A cograph_network whose weights are all 1 (or, when
signed = TRUE, 1 for a positive edge and -1 for a
negative one), or the input format when keep_format = TRUE. Nodes
left without edges are kept and reported in a
cograph_isolates_created warning, unless
keep_isolates = FALSE.
Butts, C. T. (2008). Social network analysis with sna. Journal of Statistical Software, 24(6), 1–51.
threshold_edges, normalize_weights
adj <- matrix(c(0, .5, .8, 0,
.5, 0, .3, .6,
.8, .3, 0, .4,
0, .6, .4, 0), 4, 4, byrow = TRUE)
rownames(adj) <- colnames(adj) <- c("A", "B", "C", "D")
binarize(adj, threshold = 0.45)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.