| pkern_add_bins | R Documentation |
Helper function for grouping the rows of input data frame vg into n_bins bins
according to the value of the (numeric) distance column d. This uses either base::cut
or, if probs is supplied, stats::quantile.
pkern_add_bins(vg, n_bin = 25, probs = NULL)
vg |
data frame with numeric column 'd' |
n_bin |
integer number of distance bins to assign |
probs |
numeric vector of quantile probabilities to establish breakpoints (length |
By default, the function sets probs to a sequence of length 1+n_bin evenly splitting
the interval 0,1 to ensure approximately equal sample sizes for each bin. Setting
probs=NA instead sets the bin endpoints such that the range of distances is split
evenly (note this may produce empty bins)
The function is called by pkern_sample_vg and pkern_plot_semi (when column bin is
missing). It can also be used to recompute bins after an rbind of multiple variogram
data frames.
same as input vg but with integer column bin added/modified
distance_df = data.frame(d=runif(25))
pkern_add_bins(distance_df)
# specify fewer bins and set up quantiles explicitly
pkern_add_bins(distance_df, n_bin = 5) # same as ...
pkern_add_bins(distance_df, n_bin = 5, probs=seq(0, 1, length.out=6))
# break range of distances into evenly spaced bins (of varying sample sizes)
pkern_add_bins(distance_df, n_bin = 5, probs=NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.