block_sample {biosurvey}R Documentation

Selection of blocks in environmental space

Description

Select a user-defined number of blocks in environmental space to be used in further analysis to define sampling sites for a survey system.

Usage

block_sample(master, expected_blocks, selection_type = "uniform",
             replicates = 10, set_seed = 1)

Arguments

master

master_matrix object derived from the function prepare_master_matrix or a master_selection object derived from functions random_selection, uniformG_selection, or uniformE_selection.

expected_blocks

(numeric) number of blocks to be selected.

selection_type

(character) type of selection. Two options are available: "uniform" and "random". Default = "uniform".

replicates

(numeric) number of thinning replicates performed to select blocks uniformly. Default = 10.

set_seed

(numeric) integer value to specify a initial seed. Default = 1.

Details

When blocks in master are defined using the option "equal_points" (see make_blocks), "uniform" selection_type could result in blocks with high density per area being overlooked.

Value

An S3 object of class master_matrix or master_selection, containing the same elements found in the input object, with an additional column in the master_matrix data.frame containing a binary code for selected (1) and non-selected (0) blocks.

Examples

# Data
data("m_matrix", package = "biosurvey")

# Making blocks for analysis
m_blocks <- make_blocks(m_matrix, variable_1 = "PC1",
                        variable_2 = "PC2", n_cols = 10, n_rows = 10,
                        block_type = "equal_area")

# Checking column names and values in variables to define initial distance
colnames(m_blocks$data_matrix)
summary(m_blocks$data_matrix[, c("PC1", "PC2")])

# Selecting blocks uniformly in E space
block_sel <- block_sample(m_blocks, expected_blocks = 10,
                          selection_type = "uniform")

head(block_sel$data_matrix)

[Package biosurvey version 0.1.1 Index]