# grtspts: Select a Generalized Random-Tesselation Stratified (GRTS) Sample of a Finite Resource

## Description

This function select a GRTS sample of a finite resource. This function uses
hierarchical randomization to ensure that the sample will include no more
than one point per grid cell and then picks a point in selected cells.

## Usage

grtspts(ptsframe, samplesize = 100, SiteBegin = 1, shift.grid = TRUE,
do.sample = TRUE, startlev = NULL, maxlev = 11)

## Arguments

ptsframe

The sf object containing attributes: id, x, y, mdcaty, and
mdm.

samplesize

Number of points to select in the sample. The default is
100.

SiteBegin

First number to start siteID numbering. The default is 1.

shift.grid

Option to randomly shift the hierarchical grid. The
default is TRUE.

do.sample

Option to select a sample, where TRUE means select a
sample and FALSE means return the entire sample frame in reverse
hierarchical order. The default is TRUE.

startlev

Initial number of hierarchical levels to use for the GRTS
grid, which must be less than or equal to maxlev (if maxlev is specified)
and cannot be greater than 11. The default is NULL.

maxlev

Maximum number of hierarchical levels to use for the GRTS
grid, which cannot be greater than 11. The default is 11.

## Value

Data frame of sample points containing: siteID, id, x, y, mdcaty,
and weight.

## Other Functions Required

`numLevels`

determines the number of levels for hierarchical
randomization

`constructAddr`

constructs the hierarchical address for
sample points

`ranho`

constructs the randomized hierarchical address for
sample points

`pickGridCells`

selects grid cells that get a sample point

`pickFiniteSamplePoints`

pick sample point(s) from
selected cells