Sample one or more points from a two dimensional environmental space according to a selection rule and with the possibility of having distinct sets of points to be sampled independently.
Usage
point_sample(data, variable_1, variable_2, n = 1,
select_point = "E_centroid", id_column = NULL)
Arguments
- data
matrix or data.frame that contains at least four columns: "Longitude" and "Latitude" to represent geographic position, and two other columns to represent the variables of the 2D environmental space.
- variable_1
(character or numeric) name or position of the first variable (x-axis).
- variable_2
(character or numeric) name or position of the second variable (y-axis). Must be different from the first one.
- n
(numeric) number of points to be selected. If
id_column
is defined this argument indicates the number of points per set. Default = 1.- select_point
(character) how or which point will be selected. Three options are available: "random", "E_centroid", and "G_centroid". E_ or G_ centroid indicate that the point(s) closest to the respective centroid will be selected. Default = "E_centroid".
- id_column
(character or numeric) name or numeric index of the column in
data
containing identifiers of one or distinct sets of points. If, NULL, the default, only one set is assumed.
Examples
# Data
m_matrix <- read_master(system.file("extdata/m_matrix.rds",
package = "biosurvey"))
# Sampling points
points_s <- point_sample(m_matrix$data_matrix,
variable_1 = "Max_temperature",
variable_2 = "Min_temperature", n = 1,
select_point = "E_centroid", id_column = NULL)
points_s
#> Longitude Latitude Mean_temperature Max_temperature Min_temperature
#> 213 -114.5833 32.41667 228 410 58
#> Annual_precipitation Prec_wettest_month Prec_driest_month PC1
#> 213 79 13 0 -1.189198
#> PC2 id_column
#> 213 -2.713829 1