smart_sample | R Documentation |
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.
smart_sample(pts_xy, sample_bins = NULL, sample_size = NULL,
xbins = 20, seed = 1)
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 |
A data frame consisting of the sampled points from the original input circle
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.