select_points: Select points inside sampled grid cells

View source: R/sampling.R

select_pointsR Documentation

Select points inside sampled grid cells

Description

For an area frame of square cells (segments) selected with select_units(), draws points_per_cell uniform random points inside each sampled cell. In the field, each point identifies the field (and so the establishment) it falls on; an establishment can be hit several times. The point density of a cell, pi * points / area, is what expected_hits() and point_estimator() need.

Usage

select_points(
  sample,
  points_per_cell,
  cell_size,
  layout = c("random", "systematic"),
  seed = 1
)

Arguments

sample

A fieldopt_sample of cells with coordinate columns giving the cell centres.

points_per_cell

Points per sampled cell: a single number, a vector named by stratum (for example more points where agricultural use is more intense), or the name of a column of the sample.

cell_size

Side of the square cells, in the units of the coordinates (one number, or c(dx, dy)).

layout

"random" (independent uniform points) or "systematic" (a regular grid of ⁠k1 x k2 = m⁠ points with one random offset per cell, which spreads the points inside the cell; each point is still uniform over the cell, so the density is the same).

seed

Seed.

Value

A tibble of class fieldopt_points with one row per point: unit (the cell), point, the two coordinates, pi_cell, points_in_cell and density (expected points per unit area of the cell).

Examples

cells <- expand.grid(x = 1:10, y = 1:10)
cells$unit <- paste0("c", 1:100)
s <- select_units(cells, n = 12, seed = 2)
p <- select_points(s, points_per_cell = 9, cell_size = 1, layout = "systematic")
nrow(p)
head(p)

fieldopt documentation built on Oct. 22, 2026, 1:07 a.m.