Skip to contents

Sample potential camera trap locations. For stratified sampling, provide a suitable column to stratify region by. Alternatively, sf::st_sample() is used directly to sample points across all features.

Usage

sample_ct(region, n, type, strata = NULL)

Arguments

region

spatial feature object across which points will be sampled

n

number of random points. If strata is provided, n represents the number of random points per strata

type

type of sampling, see sf::st_sample()

strata

column name in region indicating strata

Value

sf (see sf::st_sf()) object with POINT geometry

Examples

# Example grid with density levels (High, Medium, Low)
data(clearwater_lake_density)

# Stratified random points for each density level
pts_random <- sample_ct(
  region = clearwater_lake_density, n = 20,
  type = 'random', strata = 'density')

# Plot density grid and sampled points
plot(clearwater_lake_density, reset = FALSE)
plot(pts_random, add = TRUE, pch = 1, strata = 1)
#> Warning: ignoring all but the first attribute


# Regular sampled points across all features
pts_regular <- sample_ct(
  region = clearwater_lake_density, n = 20, type = 'regular')

# Plot density grid and sampled points
plot(clearwater_lake_density, reset = FALSE)
plot(pts_regular, add = TRUE, pch = 2, strata = 1)