Get the distance between points, the output will be used in get_pseudo.

get_distance(point, cpus = 4, test_mode = FALSE, test_it = 5)

Arguments

point

Each row represents a sampling site, the first column is longitude and the second column is latitude, both in decimal format.

cpus

Number of CPUs for simultaneous iterations to execute, check parallel::detectCores() for available CPUs on your machine.

test_mode

Boolean flag to execute the function with a limited number of iterations, test_it, for testing purposes only.

test_it

Number of iterations to use in the test mode.

Value

Distance matrix, the value at the i-th row, means the distance between the i-th sampling site and the whole sampling sites.

See also

Examples

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()
}