df.to.mat {ANTs} | R Documentation |
Converts a data frame into a matrix.
df.to.mat(
df,
actor,
receiver,
weighted = NULL,
tobs = NULL,
sym = FALSE,
num.ids = FALSE
)
df |
a data frame of interactions or associations. |
actor |
an integer or a string indicating the column of the individuals performing the behaviour. |
receiver |
an integer or a string indicating the column of the individuals receiving the behaviour. |
weighted |
an integer or a string indicating the column of the weights of interactions. If NULL, interactions are given a weight of 1. |
tobs |
an numeric vector or a list of numeric vectors of each individual time of observation. It has to be alphabetically ordered following unique id names. |
sym |
a boolean if true, interactions or associations are considered symmetric. |
num.ids |
a boolean if true, it returns ordered matrix according to the numeric ids. |
Converts a data frame of interactions or associations into an adjacency matrix of interactions or associations.
An adjacency matrix (undirected if argument sym is true, directed otherwise).
head(sim.focal.directed)
df.to.mat(df=sim.focal.directed,actor='actor', receiver='receiver')