
Last chance! 50% off unlimited learning
Sale ends in
sample.all
returns a matrix of all sampling variations/permutations from a set of integers
sample.all(n, size = n, replace = FALSE, prob = NULL)
Number of integers to sample from
Length of the sample vectors
Logical value; if FALSE
the sampling is without replacement; if TRUE
the sampling is with replacement
Probability vector giving the sampling probability for each element (must be a probability vector with length n
)
A matrix of all permutations of the elements 1, ..., n
(rows of the matrix give the permutations)
This function computes all sample vectors of size size
composed of the elements 1, ..., n
, either with or without replacement
of elements. If size = n
and replace = TRUE
then the list of all sample vectors corresponds to a list of all permutations of
the integers 1, ..., n
.
# NOT RUN {
sample.all(n = 4, replace = FALSE)
# }
Run the code above in your browser using DataLab