View source: R/k-NCN_curve_functions.R
kNCN_average | R Documentation |
This function accumulates samples according their proximity to all previously included samples (their centroid) as opposed to the proximity to the initial focal sample. This ensures that included samples mutually close to each other and not all over the place.
kNCN_average(
x,
n = NULL,
coords = NULL,
repetitions = 1,
no_pb = TRUE,
latlong = FALSE,
cl = NULL
)
x |
a mob_in object or a community site x species matrix |
n |
number of sites to include. |
coords |
spatial coordinates of the samples. If x is a mob_in object, the function uses its 'spat' table as coordinates. |
repetitions |
Number of times to repeat the procedure. Useful in situations where there are many ties in the distance matrix. |
no_pb |
binary, if TRUE then a progress bar is not printed, defaults to TRUE |
latlong |
if longitude latitudes are supplied |
cl |
A cluster object created by |
Internally the function constructs one curve per sample whereby each sample serves as the initial sample repetition times. Finally, the average curve is returned.
a numeric vector of estimated species richness
data(inv_comm)
data(inv_plot_attr)
inv_mob_in = make_mob_in(inv_comm, inv_plot_attr, coord_names = c('x', 'y'))
kNCN_average(inv_mob_in, n = 5)
# parallel evaluation using the parallel package
# run in parallel
library(parallel)
cl = makeCluster(2L)
clusterEvalQ(cl, library(mobr))
clusterExport(cl, 'inv_mob_in')
S_kNCN = kNCN_average(inv_mob_in, cl=cl)
stopCluster(cl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.