Skip to contents

Spatially stratified random sample points from an image by R package sf

Usage

stratified_sampling_sf(
  points,
  cellsize = c(600, 600),
  num_samples_per_stratum = 1
)

Arguments

points

a data frame contains all points in a image with X, Y coordinates.

cellsize

a vector of length 2 contains the size of each grid square. Default c(600,600).

num_samples_per_stratum

number of point selected from each grid square. Default 1.

Value

Return a vector contains index of sampled points.

Examples


data("lung5")
pt_idx<-stratified_sampling_sf(lung5, cellsize = c(600,600))