View source: R/network.update.R
update.network | R Documentation |
Replaces the edges in a network
object with the edges corresponding
to the sociomatrix or edge list specified by new
.
## S3 method for class 'network'
update(object, ...)
update_network(object, new, ...)
## S3 method for class 'matrix_edgelist'
update_network(object, new, attrname = if (ncol(new) > 2) names(new)[3], ...)
## S3 method for class 'data.frame'
update_network(object, new, attrname = if (ncol(new) > 2) names(new)[3], ...)
## S3 method for class 'matrix'
update_network(object, new, matrix.type = NULL, attrname = NULL, ...)
## S3 method for class 'ergm_state'
update_network(object, new, ...)
object |
a |
... |
Additional arguments; currently unused. |
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). |
attrname |
For a network with edge weights gives the name of the edge attribute whose names to set. |
matrix.type |
One of |
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.
update_network()
: dispatcher for network update based on the type of updating information.
update_network(matrix_edgelist)
: a method for updating a network based on a matrix-form edgelist
update_network(data.frame)
: a method for updating a network based on an edgelist
update_network(matrix)
: a method for updating a network based on a matrix
update_network(ergm_state)
: a method for updating a network based on an ergm_state
object.
ergm()
, network
#
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.