edgelist_to_matrix: Convert data from edgelist to interaction matrix

Description Usage Arguments Value Examples

View source: R/matrix_functions.R

Description

This function converts data in edgelist format to an interaction matrix.

Usage

1
edgelist_to_matrix(edgelist, identities)

Arguments

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.

Value

Produces an interaction matrix with winners in the rows and losers in the columns. Contestants are arranged according to the order specified by identities.

Examples

1
2
3
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)

straussed/DynaRankR documentation built on Feb. 18, 2020, 5:22 p.m.