sample_loc: Objects of class sample_loc

Description Usage Arguments Details Value Examples

View source: R/class_definitions.R

Description

The function sample_loc creates sample location objects, named lists holding coordinates of sample locations spread over some area and accompanying information about how the samples were generated.

Usage

1
sample_loc(data, n, M, method)

Arguments

data

A data.table object holding the cooridnates of sample locations and two identifiers. The first identifier 'id_sample' is used to separate repeated samples of size n from each other. There should be M distinct integers. The second identifier 'id_point' is used to identify individual sample locations in a specific sample. Both identifiers should be provided as integers. The next two columns - 'x_s' and 'y_s' - are used for the coordinates and should be provided as doubles.

n

Sample size

M

Number of repeated samples

method

Were the points spread out randomly or regular

Details

Before object initialization, a couple of checks are performed, e.g., column names, data types, data consitency, etc.

In case random sampling was performed, each sample in data should have exactly n sample locations. If systematic sampling was applied, sample size varies from sample to sample depending on the shape of the study region and sample size. If the expected sample size (n) provided by the user, deviates by more than 1 from the average sample size inferred from data, a warning is thrown rather than an error.

The prefered way for creating objects of type sample_loc is via the xy_sample function.

Value

An object of class sample_loc. A named list with the following four entries:

  1. $data A data.table object containing two identifier columns and two columns for storing coordinates

  2. $n Sample size

  3. $M Number of repeated samples

  4. $method Random or regular placement of sample locations

Examples

1
2
library(spatstat);
xy_sample(letterR, n = 10, M = 10, method = "random");

AWF-GAUG/fisim documentation built on May 28, 2019, 11:02 a.m.