Documentation for SLiM function testConstraints, 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.

testConstraints(individuals, constraints, returnIndividuals)

Arguments

individuals

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

constraints

An object of type string. Must be of length 1 (a singleton). See details for description.

returnIndividuals

An object of type logical. Must be of length 1 (a singleton). The default value is F. See details for description.

Value

An object of type logical or Individual object.

Details

Documentation for this function can be found in the official SLiM manual: page 698.

Tests the individuals in the parameter individuals against the interaction constraints specified by constraints. The value of constraints may be "receiver" to use the receiver constraints, or "exerter" to use the exerter constraints. If returnIndividuals is F (the default), a logical vector will be returned, with T values indicating that the corresponding individual satisfied the constraints, F values indicating that it did not. If returnIndividuals is T, an object vector of class Individual will be returned containing only those elements of individuals that satisfied the constraints (in the same order as individuals). Note that unlike most queries, the InteractionType does not need to have been evaluated before calling this method, and the individuals passed in need not belong to a single population or even a single species. This method can be useful for narrowing a vector of individuals down to just those that satisfy constraints. Outside the context of InteractionType, similar functionality is provided by the Subpopulation method subsetIndividuals(). Note that the use of testConstraints() is somewhat rare; usually, queries are evaluated across a vector of individuals, each of which might or might not satisfy the defined constraints. Individuals that do not satisfy constraints do not participate in interactions, so their interaction strength with other individuals will simply be zero. See the setConstraints() method to set up constraints, as well as the sexSegregation parameter to initializeInteractionType(). Note that if the constraints tested involve tag values (including tagL0 / tagL1 / tagL2 / tagL3 / tagL4), the corresponding property or properties of the tested individuals must be defined (i.e., must have been set to a value), or an error will result because the constraints cannot be applied.

Author

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