add.edges {network} | R Documentation |
Add one or more edges to an existing network object.
add.edge(x, tail, head, names.eval=NULL, vals.eval=NULL, edge.check=FALSE, ...) add.edges(x, tail, head, names.eval=NULL, vals.eval=NULL, ...)
x |
an object of class |
tail |
for |
head |
for |
names.eval |
for |
vals.eval |
for |
edge.check |
logical; should we perform (computationally expensive) tests to check for the legality of submitted edges? |
... |
additional arguments |
The edge checking procedure is very slow, but should always be employed when debugging; without it, one cannot guarantee that the network state is consistent with network level variables (see network.indicators
).
Edges can also be added/removed via the extraction/replacement operators. See the associated man page for details.
Invisibly, add.edge
and add.edges
return pointers to their modified arguments; both functions modify their arguments in place..
Carter T. Butts buttsc@uci.edu
Butts, C. T. (2008). “network: a Package for Managing Relational Data in R.” Journal of Statistical Software, 24(2). http://www.jstatsoft.org/v24/i02/
network
, add.vertices
, network.extraction
, delete.edges
#Initialize a small, empty network g<-network.initialize(3) #Add an edge add.edge(g,1,2) g #Can also add edges using the extraction/replacement operators g[,3]<-1 g[,]