Skip to contents

Helper to create objects to detect points to close to preselected sites

Usage

preselected_dist_mask(master, expected_points, space, variable_1 = NULL,
                      variable_2 = NULL, use_blocks = FALSE,
                      verbose = TRUE)

Arguments

master

master_matrix object derived from function prepare_master_matrix or master_selection object derived from functions random_selection, uniformE_selection, or EG_selection.

expected_points

(numeric) number of survey points (sites) to be selected.

space

(character) space in which the thinning will be performed. There are two options available: "G", if it will be in geographic space, and "E", if it will be in environmental space.

variable_1

(character or numeric) name or position of the first variable (x-axis). Default = NULL.

variable_2

(character or numeric) name or position of the second variable (y-axis). Default = NULL.

use_blocks

(logical) whether or not to use block centroids instead of all points when space = "E". Default = FALSE.

verbose

(logical) whether or not to print messages about the process. Default = TRUE.

Value

A list of two elements: the distance used to obtain expected_points

and a SpatVector object created from preselected_sites in master.

Examples

# Data
m_matrix_pre <- read_master(system.file("extdata/m_matrix_pre.rds",
                                        package = "biosurvey"))

# Running
pdm <- preselected_dist_mask(master = m_matrix_pre, expected_points = 20,
                             space = "G")
#> Running distance optimization, please wait...