Calculate one of several measures of spatial proximity
proximity(
scene,
method,
averageType = "mean",
subject = "all",
zeroPotDist = NULL,
k = 6
)A potentials object containing one more more of the following, depending the
input for subject:
If subject is "population" the return list will contain a numeric
value that has a range depending on the method. If
subject is "pair" the return list will contain a matrix
with all pairwise proximity comparisons. If subject is "individual"
the return list will contain a dataframe with a column containing IDs and
a column containing proximity values. If subject is "all"
the return list will contain all three of the items above.
a matingScene object
one of "maxProp", "maxPropSqrd", or 'knn.dist'; see details for further description
whether to calculate individual and population proximity using the mean or median
whether you want pair, individual, population, or all. Specifying more than one is allowed.
the distance at which potential should be equal to zero
the number of the nearest neighbor to search, if method is "knn.dist". Defaults to 6, but must be less than population size.
Danny Hanson
If method is "maxProp" then proximity between two
individuals will be calculated as 1 - distance/max(distance).
If method is "maxPropSqrd" then proximity between two
individuals will be calculated as (1 - distance/max(distance))^2. If method is
"knn.dist" then the function This uses FNN::knn.dist to return the Euclidian distance of the kth nearest neighbor.
pop <- simulateScene()
proximity(pop, "maxProp")
Run the code above in your browser using DataLab