as.sociomatrix.eventlist {relevent} | R Documentation |
Convert an Event List Into a Sociomatrix
Description
Convert a dyadic event list into an adjacency matrix, such that the i,j
cell value is the number of (i,j)
events in the list.
Usage
as.sociomatrix.eventlist(eventlist, n = NULL)
Arguments
eventlist |
a three-column numeric matrix (or equivalent), containing the event list to be converted. |
n |
the number of vertices. If omitted, this is assumed to be contained in an attribute called |
Details
An event list must be a three-column matrix (or something that can be treated as one), whose second and third columns must contain vertex IDs; these can be given as characters, but must be coercable with as.numeric
to numeric form. Vertex IDs must be integers from 1:n
, where n
is either supplied as an argument, or attached as an attribute of the eventlist
object. The first column of an eventlist matrix conventionally contains the event time, and is ignored; the second and third should contain the IDs of the senders and receivers of events (respectively). Rows with missing values for one or both vertex IDs are removed during processing (but NA
s in the first column have no effect, since the event timing information is not used).
The resulting output is an n
by n
adjacency matrix, whose i,j
cell is the total number of events in eventlist
from vertex i
to vertex j
. This can be useful for visualizing or otherwise analyzing the time-marginalized structure of a dyadic interaction network.
Value
A sociomatrix containing the time-aggregated event counts.
Author(s)
Carter T. Butts buttsc@uci.edu
See Also
Examples
#Create a simple event list
el <- cbind(1:6, c(4,4,4,1,3,4), c(1,2,3,3,1,1))
#Convert to matrix form
as.sociomatrix.eventlist(el, 4)
#Can also store n as an attribute
attr(el, "n") <- 4
as.sociomatrix.eventlist(el)