
Returns the mean of a neighborhood's attribute for all or a subset of nodes in the language network.
get_neighbor_mean.RdReturns the mean of a neighborhood's attribute for all or a subset of nodes in the language network.
Arguments
- network
An
igraphnetwork object, generated bymake_network()ormake_network_sep()functions.- node_name
A vector containing node names to obtain values for. Node names must be found in
igraph::V(network)$name. If unspecified, the default is to return values for all nodes in the network.- attribute
A string stating the node attribute to obtain the mean values for. The attribute must be found in
igraph::vertex_attr_names(network). Typically it will be one of the node attribute columns in theitem_dfdata frame object used to create the network.
Examples
# Use the demo data for executing examples
test <- make_network(sample1)
#>
|
| | 0%
|
|======== | 11%
|
|================ | 22%
|
|======================= | 33%
|
|=============================== | 44%
|
|======================================= | 56%
|
|=============================================== | 67%
|
|====================================================== | 78%
|
|============================================================== | 89%
get_neighbor_mean(network = test, attribute = "length") # all nodes
#> cat bat cut cap hat chat heat hate spinach
#> 3.2 3.0 3.0 3.0 3.6 3.0 3.0 3.0 NaN
get_neighbor_mean(network = test, node_name = "cat", attribute = "length") # for 1 node
#> cat
#> 3.2