totalOfNeighborStrengths: SLiM method totalOfNeighborStrengths

Description Usage Arguments Details Value Copyright Author(s)

View source: R/slim_lang.R

Description

Documentation for SLiM function totalOfNeighborStrengths, which is a method of the SLiM class InteractionType. Note that the R function is a stub, it does not do anything in R (except bring up this documentation). It will only do anything useful when used inside a slim_block function further nested in a slim_script function call, where it will be translated into valid SLiM code as part of a full SLiM script.

Usage

1

Arguments

individuals

An object of type Individual object. See details for description.

Details

Returns a vector of the total interaction strength felt by each individual in individuals, which does not need to be a singleton; indeed, it can be a vector of all of the individuals in a given subpopulation. However, all of the individuals in individuals must be in the same subpopulation. For one individual, this is essentially the same as calling nearestNeighbors() with a large count so as to obtain the complete vector of all neighbors, calling strength() for each of those interactions to get each interaction strength, and adding those interaction strengths together with sum(). This method is much faster than that implementation, however, since all of that work is done as a single operation. Also, totalOfNeighborStrengths() can total up interactions for more than one focal individual in a single call. Similarly, for one individual this is essentially the same as calling strength() to get the interaction strengths between the focal individual and all other individuals, and then calling sum(). Again, this method should be much faster, since this algorithm looks only at neighbors, whereas calling strength() directly assesses interaction strengths with all other individuals. This will make a particularly large difference when the subpopulation size is large and the maximum distance of the InteractionType is small. If the needed interaction strengths have already been calculated, those cached values are simply used. Otherwise, calling this method triggers evaluation of the needed interactions, including calls to any applicable interaction() callbacks.

Value

An object of type float.

Copyright

This is documentation for a function in the SLiM software, and has been reproduced from the official manual, which can be found here: http://benhaller.com/slim/SLiM_Manual.pdf. This documentation is Copyright © 2016–2020 Philipp Messer. All rights reserved. More information about SLiM can be found on the official website: https://messerlab.org/slim/

Author(s)

Benjamin C Haller (bhaller@benhaller.com) and Philipp W Messer (messer@cornell.edu)


rdinnager/slimrlang documentation built on June 20, 2020, 8:17 p.m.