get_dynamics {DynaRankR} | R Documentation |
Calculate hierarchy dynamics
Description
Calculates hierarchy dynamics from an inferred longitudinal hierarchy, returning the provided longitudinal hierarchy with added columns. The function calculates hierarchy dynamics for each individual in each period (excluding the first period). Dynamics can be calculated in rank units or score units by specifying the type parameter. Rank dynamics are returned as the total dynamics (delta), active dynamics (delta.active), and passive dynamics (delta.passive). Score dynamics are calculated as delta. See Strauss & Holekamp (in revision) for more details.
Usage
get_dynamics(ranks, type = c("rank", "score"))
Arguments
ranks |
A dataframe such as the output of the ranking functions provided in the DynaRankR package. Should include at least the following columns:
|
type |
A character string, either 'score' or 'rank'. Determines whether rank dynamics or score dynamics are calculated. |
Value
Returns the supplied dataframe with new column(s) for hierarchy dynamics. New individuals receive NA for all dynamics because they can not have undergone any changes.
References
Strauss ED & Holekamp KE (in revision). Journal of Animal Ecology.
Examples
female.ranks <- informed_elo(contestants = C.crocuta.female$contestants, convention = 'mri',
initial.ranks = C.crocuta.female$initial.ranks,
interactions = C.crocuta.female$interactions)
female.ranks.score <- get_dynamics(ranks = female.ranks, type = 'score')
female.ranks.rank <- get_dynamics(ranks = female.ranks, type = 'rank')