getHaltonPointsFromExpandableGrid: Generate a Halton frame.

View source: R/getHaltonPointsFromExpandableGrid.R

getHaltonPointsFromExpandableGridR Documentation

Generate a Halton frame.

Description

Find the requested number of Halton points from within a study area using the supplied J and seeds parameters. If the number of points are not found on the first attempt, the frame is expanded, and spbal::getHaltonFrame is called again. This process is repeated until the requested number of points are found. The points and the seeds used to generate the sample are returned to the caller.

Usage

getHaltonPointsFromExpandableGrid(
  shapefile,
  N,
  J = base::c(4, 3),
  bases,
  seeds,
  crs,
  verbose = FALSE,
  stratify_found_first = FALSE
)

Arguments

shapefile

Shape file as a polygon (sp or sf) of the study area(s).

N

Number of sites to select. If using stratification it is a named vector containing sample sizes of each group.

J

The number of grid cells. A list of 2 values. The default value is c(3, 2).

bases

Co-prime base for the Halton Sequence. The default value is c(2, 3).

seeds

A vector of 2 seeds, u1 and u2.

crs

Coordinate reference system for the shapefile.

verbose

Boolean if you want to see any output printed to screen. Helpful if taking a long time. Default is FALSE i.e. no informational messages are displayed.

stratify_found_first

A flag to indicate whether we have found the first point in the study region or not. Default FALSE.

Value

A list containing five variables:

  • i The index of the first point chosen at random in the study area.

  • diff_ Halton points, the intersection of the bounding box and the study area.

  • pts.shp Halton frame, the sample points within the study area.

  • bb.new The bounding box.

  • seeds The u1 and u2 seeds used to generate the sample.

Author(s)

Phil Davies.


spbal documentation built on April 4, 2025, 2:05 a.m.