convert_perc: Convert displacements for use by the Perc package

View source: R/convert.R

convert_percR Documentation

Convert displacements for use by the Perc package

Description

Converts displacements RFID data into a format for easy use by the Perc::as.conflictmat() function included in the Perc package. Can then be applied to internal Perc functions for calculating dominance from perculation and conductance. Only includes individuals that participated in at least one interaction.

Usage

convert_perc(d)

Arguments

d

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

Value

A data frame of interactions for input into Perc::as.conflictmat(). See examples for specific application.

See Also

Perc package and it's function as.conflictmat. https://cran.r-project.org/package=Perc

Examples

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

# Format for use by Perc package
i <- convert_perc(d)
i <- convert_perc(d$interactions) # Equivalent

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

# Calculate ranks (adapted from Perc examples)
conflict_mat <- as.conflictmat(i, weighted = TRUE)
perm <- conductance(conflict_mat, 2)
simRankOrder(perm$p.hat, num = 10, kmax = 1000)


## End(Not run)


animalnexus/feedr documentation built on Feb. 2, 2023, 1:12 a.m.