sk_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
.
sk_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 sk_sample_vg
and sk_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
Other variogram functions:
sk_vario_fun()
distance_df = data.frame(d=runif(25))
sk_add_bins(distance_df)
# specify fewer bins and set up quantiles explicitly
sk_add_bins(distance_df, n_bin = 5) # same as ...
sk_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)
sk_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.