Learn R Programming

network (version 1.0-1)

as.network.matrix: Coercion from Matrices to Network Objects

Description

as.network.matrix attempts to coerce its first argument to an object of class network.

Usage

as.network.default(x, ...)
as.network.matrix(x, matrix.type = NULL, directed = TRUE, 
    hyper = FALSE, loops = FALSE, multiple = FALSE, bipartite = FALSE,
    ignore.eval = TRUE, names.eval = NULL, na.rm = FALSE, 
    edge.check = FALSE, ...)

Arguments

x
a matrix containing an adjacency structure
matrix.type
one of "adjacency", "edgelist", "incidence", or NULL
directed
logical; should edges be interpreted as directed?
hyper
logical; are hyperedges allowed?
loops
logical; should loops be allowed?
multiple
logical; are multiplex edges allowed?
bipartite
count; should the network be interpreted as bipartite? If present (i.e., non-NULL) it is the count of the number of actors in the bipartite network. In this case, the number of nodes is equal to the number of actors plus the number of events (with all act
ignore.eval
logical; ignore edge values?
names.eval
optionally, the name of the attribute in which edge values should be stored
na.rm
logical; ignore missing entries when constructing the network?
edge.check
logical; perform consistency checks on new edges?
...
additional arguments

Value

  • An object of class network

Details

Depending on matrix.type, one of three edgeset constructor methods will be employed to read the input matrix (see edgeset.constructors). If matrix.type==NULL, which.matrix.type will be used to guess the appropriate matrix type.

References

Butts, C.T. 2002. ``Memory Structures for Relational Data in R: Classes and Interfaces'' Working Paper.

See Also

edgeset.constructors, network, which.matrix.type

Examples

Run this code
#Draw a random matrix
m<-matrix(rbinom(25,1,0.5),5)
diag(m)<-0

#Coerce to network form
g<-as.network.matrix(m,matrix.type="adjacency")

Run the code above in your browser using DataLab