Description Usage Arguments Value Examples
Create a random sequence of equally distributed values
1 | equalDistribution(x, length.out = length(x), do.stop = TRUE)
|
x |
Vector of values to be chosen from |
length.out |
Length of the output vector to be created |
do.stop |
If |
Vector of length.out
values all of which are elements of
x
. If length.out
is a multiple of the lenght of x
the
values are equally distributed. Otherwise (and if do.stop
is
FALSE
so that no error is thrown) the frequencies of the values
differ by one at most.
1 2 3 4 5 6 7 8 9 10 11 12 | y1 <- equalDistribution(x = LETTERS[1:2], 10)
# Check the distribution with table
table(y1)
# Do all values occur with the same frequency?
all(diff(table(y1)) == 0)
y2 <- equalDistribution(x = LETTERS[1:3], length.out = 11, do.stop = FALSE)
# Do the frequencies differ by one at most?
all(diff(table(y2)) <= 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.