Get the distance between points, the output will be used in
get_pseudo
.
get_distance(point, cpus = 4, test_mode = FALSE, test_it = 5)
Each row represents a sampling site, the first column is longitude and the second column is latitude, both in decimal format.
Number of CPUs for simultaneous iterations to execute, check
parallel::detectCores()
for available CPUs on your machine.
Boolean flag to execute the function with a limited number
of iterations, test_it
, for testing purposes only.
Number of iterations to use in the test mode.
Distance matrix, the value at the i-th
row, means the distance
between the i-th
sampling site and the whole sampling sites.
if (FALSE) {
# Load modern pollen data
modern_pollen <- read.csv("/path/to/modern_pollen.csv")
point <- modern_pollen[, c("Long", "Lat")]
test_mode <- TRUE # It should be set to FALSE before running
dist <- fxTWAPLS::get_distance(
point,
cpus = 2, # Remove the following line
test_mode = test_mode
)
# Run with progress bar
`%>%` <- magrittr::`%>%`
dist <- fxTWAPLS::get_distance(
point,
cpus = 2, # Remove the following line
test_mode = test_mode
) %>%
fxTWAPLS::pb()
}