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.
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 "n" attached to eventlist.
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 NAs 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.
Returns
A sociomatrix containing the time-aggregated event counts.
#Create a simple event listel <- cbind(1:6, c(4,4,4,1,3,4), c(1,2,3,3,1,1))#Convert to matrix formas.sociomatrix.eventlist(el,4)#Can also store n as an attributeattr(el,"n")<-4as.sociomatrix.eventlist(el)