edgelist_to_matrix {DynaRankR} | R Documentation |
This function converts data in edgelist format to an interaction matrix.
edgelist_to_matrix(edgelist, identities)
edgelist |
A two column matrix or dataframe with the identities of winners in the first column and losers in the second column. |
identities |
A list of contestant identities. This list dictates the order in which contestants are arranged in the resulting matrix. |
Produces an interaction matrix with winners in the rows and losers in the columns. Contestants are arranged according to the order specified by identities.
edges <- C.crocuta.female$interactions[C.crocuta.female$interactions$period == 1989,1:2] ids <- C.crocuta.female$contestants[C.crocuta.female$contestants$period == 1989,'id'] edgelist_to_matrix(edgelist = edges, identities = ids)