draw_random_samples: Draw random sample

View source: R/BASS_grts.R

draw_random_samplesR Documentation

Draw random sample

Description

Draw random sample

Usage

draw_random_samples(
  land_hex,
  num_runs,
  n_samples,
  use_grts = TRUE,
  crs = 4326,
  coords = c("lon", "lat"),
  return_grts = FALSE,
  seed = NULL,
  quiet = FALSE,
  ...
)

Arguments

land_hex

(Spatial) Data frame. Land Cover data by hexagon. If non-spatial, will be converted to spatial sf data frame using the crs and coords arguments. Requires columns identifying the Hex ID as well as the Stratum ID (see hex_id and stratum_id respectively).

num_runs

Numeric. Number of times to draw random samples.

n_samples

Numeric. Number of samples to draw in each run.

use_grts

Logical. Whether to use spsurvey::grts() or just sample randomly without spatial dispersion.

crs

Numeric, character, or sf/sfc. Coordinate reference system. Must be valid input to sf::st_crs().

coords

Character vector. Names of the columns containing X and Y coordinates (default c("lon", "lat")).

return_grts

Logical. Return the spsurvey object(s).

seed

Numeric. Random seed to use for random sampling. Seed only applies to specific sampling events (does not change seed in the environment). NULL does not set a seed.

quiet

Logical. Whether to suppress progress messages.

...

Extra named arguments passed on to spsurvey::grts().

Value

Spatial data frame of samples

Examples


draw_random_samples(psu_hexagons, num_runs = 1, n_samples = 10)


dhope/BASSr documentation built on April 12, 2024, 9:54 p.m.