is_weighted.network: Check if an object is weighted

Description Usage Arguments Value Examples

View source: R/networks.R

Description

Check if an object is weighted

Usage

1
2
## S3 method for class 'network'
is_weighted(x, ...)

Arguments

x

Either a 'network', 'network_module', or 'matrix' object.

...

Additional arguments. object are weighted by 0s and 1s, and returns TRUE otherwise. If there are no connections in the module, then this function returns TRUE.

Value

A Boolean value indicating whether the input is weighted.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Create a random network with 10 nodes. 
nw <- random_network(10)
# The network, and hence all of its modules, are unweighted.
is_weighted(nw)
sapply(nw$modules, is_weighted)
# Add random weights to the connections.
nw <- gen_partial_correlations(nw)
# The network, and hence all of its modules, are now weighted.
is_weighted(nw)
sapply(nw$modules, is_weighted)

SeqNet documentation built on July 9, 2021, 9:08 a.m.