Documentation for SLiM function sampleNearbyPoint, which is a method of the SLiM class SpatialMap. 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.

sampleNearbyPoint(point, maxDistance, functionType, ...)

Arguments

point

An object of type float. See details for description.

maxDistance

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

functionType

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

...

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

Value

An object of type float.

Details

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

For a spatial point supplied in point, returns a nearby point sampled from a kernel weighted by the spatial map's values. Only points within the maximum distance of the kernel, maxDistance, will be chosen, and the probability that a given point is chosen will be proportional to the density of the kernel at that point multiplied by the value of the map at that point (interpolated, if interpolation is enabled for the map). Negative values of the map will be treated as zero. The point returned will be within spatial bounds, respecting periodic boundaries if in effect (so there is no need to call pointPeriodic() on the result). The kernel is specified with a kernel shape, functionType, followed by zero or more ellipsis arguments; see smooth() for further information. For this method, at present only kernel types "f", "l", "e", "n", and "t" are supported, and type "t" is not presently supported for 3D kernels. This method can be used to find points in the vicinity of individuals that are favorable - possessing more resources, or better environmental conditions, etc. It can also be used to guide the dispersal or foraging behavior of individuals. See sampleImprovedNearbyPoint() for a variant that may be useful for directed movement across a landscape. Note that the algorithm for sampleNearbyPoint() works by rejection sampling, and so will be very inefficient if the maximum value of the map (anywhere, across the entire map) is much larger than the typical value of the map where individuals are. The algorithm for sampleImprovedNearbyPoint() is different, and does not exhibit this performance issue.

Author

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