mixingmatrix | R Documentation |
Return the mixing matrix for a network, on a given attribute.
mixingmatrix(object, ...)
## S3 method for class 'network'
mixingmatrix(object, attrname, useNA = "ifany", expand.bipartite = FALSE, ...)
## S3 method for class 'mixingmatrix'
x[[...]]
## S3 method for class 'mixingmatrix'
x$name
## S3 method for class 'mixingmatrix'
is.directed(x, ...)
## S3 method for class 'mixingmatrix'
is.bipartite(x, ...)
## S3 method for class 'mixingmatrix'
print(x, ...)
object |
a network or some other data structure for which a mixing matrix is meaningful. |
... |
arguments passed to |
attrname |
a vertex attribute name. |
useNA |
one of "ifany", "no" or "always". Argument passed to
|
expand.bipartite |
logical; if |
x |
mixingmatrix object |
name |
name of the element to extract, one of "matrix" or "type" |
Handling of missing values on the attribute attrname
almost
follows similar logic to table
. If there are NA
s on
the attribute and useNA="ifany"
(default) the result will contain
both row and column for the missing values to ensure the resulting matrix
is square (essentially calling table
with
useNA="always"
). Also for that reason passing exclude
parameter with NULL
, NA
or NaN
is ignored with a
warning as it may break the symmetry.
Function mixingmatrix()
returns an object of class mixingmatrix
extending table
with a cross-tabulation of edges in the object
according to the values of attribute attrname
for the two incident
vertices. If object
is a directed network rows correspond to the "tie
sender" and columns to the "tie receiver". If object
is an undirected
network there is no such distinction and the matrix is symmetrized. In both
cases the matrix is square and all the observed values of the attribute
attrname
are represented in rows and columns. If object
is a
bipartite network and expand.bipartite
is FALSE
the resulting matrix
does not have to be square as only the actually observed values of the
attribute are shown for each partition, if expand.bipartite
is TRUE
the
matrix will be square.
Functions is.directed()
and is.bipartite()
return TRUE
or
FALSE
. The values will be identical for the input network object
.
The $
and [[
methods are included only for backward-compatiblity
reason and will become defunct in future releases of the package.
# Interaction ties between Lake Pomona SAR organizations by sponsorship type
# of tie sender and receiver (data from Drabek et al. 1981)
data(emon)
mixingmatrix(emon$LakePomona, "Sponsorship")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.