vec_sample | R Documentation |
base::sample()
Using the vctrs Packagesample()
behaves unexpectedly when called on
objects other than atomic vectors. This re-implementation has identical logic
but uses the vctrs package to generalize to
other inputs. Parameters are modeled after
slice_sample()
.
vec_sample(.x, n, replace = FALSE, weight_by = NULL)
.x |
The data to sample |
n |
The number of samples to return |
replace |
Should sampling be performed with ( |
weight_by |
Sampling weights. This must evaluate to a vector of non-negative numbers the same length as the input. Weights are automatically standardised to sum to 1. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.