df.to.mat: Data frame to a matrix

View source: R/df.to.mat.R

df.to.matR Documentation

Data frame to a matrix

Description

Converts a data frame into a matrix.

Usage

df.to.mat(
  df,
  actor,
  receiver,
  weighted = NULL,
  tobs = NULL,
  sym = FALSE,
  num.ids = FALSE
)

Arguments

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.

Details

Converts a data frame of interactions or associations into an adjacency matrix of interactions or associations.

Value

An adjacency matrix (undirected if argument sym is true, directed otherwise).

Examples

head(sim.focal.directed)
df.to.mat(df=sim.focal.directed,actor='actor', receiver='receiver')

SebastianSosa/ANTs documentation built on Sept. 25, 2023, 11:06 p.m.