dyad_id: Dyad ID

Description Usage Arguments Details Value Examples

View source: R/dyad_id.R

Description

Build unique ID for dyads of focal individuals (and neighbours).

Usage

1
dyad_id(DT = NULL, focal = "id", neighbour = NULL, both = FALSE)

Arguments

DT

data.table.

focal

focal individual.

neighbour

neighbours, optional - see Details.

both

if both is TRUE, returns duplicated dyadIDs with all focal/neighbour inverted and appended.

Details

This function builds a dyad ID: focal A -> neighbour B (and focal B -> neighbour A) = dyad 1.

Value

If neighbour is not provided, all potential dyads are returned as a "dyad dictionary".

Alternatively, when observed neighbours are provided, a "dyadID" column is added to the data.table with the individuals

Examples

1
2
3
4
5
6
7
# Load data.table
library(data.table)

# Read example data
DT <- fread(system.file("extdata", "DT.csv", package = "toast"))

dyadDict <- dyad_id(DT, focal = 'ID', neighbour = NULL)

robitalec/toast documentation built on May 17, 2019, 3:14 a.m.