partial_permut | R Documentation |
Get partial permutation of a vector
partial_permut(x, exp_sim = 0)
x |
a vector with at least 2 elements |
exp_sim |
a value between 0 and 1 indicating the level of expected similarity between the input and output vector. Default value is 0 (random permutation). |
a partially (random) permutated vector. If exp_sim = 0
then
the result is equal to sample(x)
(a random permutation). If
exp_sim = 1
then the result is always the same as the input vector.
For exp_sim
values between 0 and 1 we randomly sample
a subset of the input vector inversely proportionate to the exp_sim
value (e.g. exp_sim = 0.8 => 20%
of the elements) and randomly
permutate these elements only.
set.seed(42)
partial_permut(x = LETTERS, exp_sim = 0)
partial_permut(x = LETTERS, exp_sim = 0.5)
partial_permut(x = LETTERS, exp_sim = 0.9)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.