smart_sample: Implementation of a smart sampling algorithm

View source: R/functions.R

smart_sampleR Documentation

Implementation of a smart sampling algorithm

Description

Define a smart sampling function which will ensure uniform samples so that we can get better results even with a lower ncross value. This process will divide the input circle area into hexbins and assign probabilities to the bins which will be correlated with the number of points in the bin. This will result in sampling the points from high density areas while still ensuring a more uniform distribution.

Usage

smart_sample(pts_xy, sample_bins = NULL, sample_size = NULL,
  xbins = 20, seed = 1)

Arguments

pts_xy

The set of points (for example, the input circle of a shoeprint)

sample_bins

The number of hexbins to sample

sample_size

The number of points within each bin to sample

xbins

Defines the grid of hexbins to divide the overall image (by default, 20x20)

seed

The random seed for reproducing results

Value

A data frame consisting of the sampled points from the original input circle

Examples

## Not run: 
data(input_example)

smart_sample(input_example, sample_bins = NULL, sample_size = NULL) # All points from all bins
smart_sample(input_example, sample_bins = 30 & sample_size = NULL) # All points from 30 bins
smart_sample(input_example, sample_bins = NULL, sample_size = 30) # 30 points from all bins
smart_sample(input_example, sample_bins = 30, sample_size = 1) # one point from 30 selected bins

## End(Not run)

erichare/shoeprintr documentation built on May 3, 2024, 6:45 a.m.