Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

update.network

Update the edges in a network based on a matrix


Description

Replaces the edges in a network object with the edges corresponding to the sociomatrix or edge list specified by new.

Usage

## S3 method for class 'network'
update(
  object,
  new,
  matrix.type = NULL,
  attrname = NULL,
  ...,
  ignore.nattr = c("bipartite", "directed", "hyper", "loops", "mnext", "multiple", "n"),
  ignore.vattr = c()
)

Arguments

object

a network object.

new

Either an adjacency matrix (a matrix of values indicating the presence and/or the value of a tie from i to j) or an edge list (a two-column matrix listing origin and destination node numbers for each edge, with an optional third column for the value of the edge).

matrix.type

One of "adjacency" or "edgelist" telling which type of matrix new is. Default is to use the which.matrix.type function.

attrname

For a network with edge weights gives the name of the edge attribute whose names to set.

...

Additional arguments; currently unused.

ignore.nattr

Character vector of the names of network-level attributes to ignore when updating network objects (defaults to standard network properties).

ignore.vattr

Character vector of the names of vertex-level attributes to ignore when updating network objects.

Value

A new network object with the edges specified by new and network and vertex attributes copied from the input network object. Input network is not modified.

See Also

Examples

#
data(florentine)
#
# test the network.update function
#
# Create a Bernoulli network
rand.net <- network(network.size(flomarriage))
# store the sociomatrix 
rand.mat <- rand.net[,]
# Update the network
update(flomarriage, rand.mat, matrix.type="adjacency")
# Try this with an edgelist
rand.mat <- as.matrix.network.edgelist(flomarriage)[1:5,]
update(flomarriage, rand.mat, matrix.type="edgelist")

ergm

Fit, Simulate and Diagnose Exponential-Family Models for Networks

v3.11.0
GPL-3 + file LICENSE
Authors
Mark S. Handcock [aut], David R. Hunter [aut], Carter T. Butts [aut], Steven M. Goodreau [aut], Pavel N. Krivitsky [aut, cre] (<https://orcid.org/0000-0002-9101-3362>), Martina Morris [aut], Li Wang [ctb], Kirk Li [ctb], Skye Bender-deMoll [ctb], Chad Klumb [ctb], Michał Bojanowski [ctb], Ben Bolker [ctb]
Initial release
2020-10-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.