convert_dominance: Convert displacements for use by functions from the Dominance...

View source: R/convert.R

convert_dominanceR Documentation

Convert displacements for use by functions from the Dominance package

Description

Converts displacements RFID data into a format for easy use by either the Dominance::ADI() or the Dominance::Sociogram() functions included in the Dominance package for calculating average dominance indices and drawing sociograms. Only includes individuals that participated in at least one interaction.

Usage

convert_dominance(d)

Arguments

d

Data frame or List. Either the specific displacements data frame which is returned as a list item from disp(), or the whole displacements list returned by disp().

Value

List of data frames to use in functions from the Dominance package. data_sheet contains all interactions: action.from/action.to represent individuals (code is matched to animal_id in the items data frame). action.from represent displacers (winners), action.to represent displacees (losers), kind.of.action is a dummy variable representing the action type (displacement). items is a data frame matching animal_ids to to the code used in the data_sheet. actions contain the one action type (displacements) and the classification and weighting (corresponds to action.from being a winner, and action.to being a loser). bytes is a dummy vector indicating that the action type "displacement" should be included in the calculation. See examples for specific application.

See Also

Dominance package and it's functions: Dominance::ADI and Dominance::Sociogram. https://cran.r-project.org/package=Dominance

Examples

# Calculate displacements
d <- disp(visits(finches_lg))

# Format for use by Dominance package
i <- convert_dominance(d)
i <- convert_dominance(d$displacements) # Equivalent

## Not run: 
# Use Dominance package:
library(Dominance)

# Calculate the Average Dominance Index
ADI(data_sheet = i$data_sheet, items = i$items, actions = i$actions, bytes = i$bytes)

# Construct social network graphs
Sociogram(data_sheet = i$data_sheet, items = i$items, actions = i$actions, bits = i$bytes)

## End(Not run)


steffilazerte/feedr documentation built on Jan. 27, 2023, 3:46 a.m.