Description Usage Arguments Value Author(s) See Also Examples
Sample tuples of elements from a set. The elements within a sampled tuple are unique, i.e. no two elements are the same.
1 2 | ## Default S3 method:
sampleTuples(x, size, length, ...)
|
x |
A set of elements to sample from. |
size |
The number of tuples to sample. |
length |
The length of each tuple. |
... |
Additional arguments passed to |
Returns a NxK matrix
where N = size
and K = length
.
Henrik Bengtsson
sample
().
1 2 3 4 5 6 7 8 9 | pairs <- sampleTuples(1:10, size=5, length=2)
print(pairs)
triples <- sampleTuples(1:10, size=5, length=3)
print(triples)
# Allow tuples with repeated elements
quadruples <- sampleTuples(1:3, size=5, length=4, replace=TRUE)
print(quadruples)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.