| urnsamples | R Documentation |
Sampling from Urns This function creates a sample space associated with the experiment of sampling distinguishable objects from an urn.
urnsamples(x, ...)
x |
a vector or data frame from which sampling should take place. |
... |
further arguments to be passed to or from other methods. |
The function operates on the indices of the urn (or rows, in the case urn is a data frame). It then takes those samples and substitutes back into urn to generate the entries of the data frame (or list, respectively). In the case that urn has repeated values, the result will be repeated values in the output. Note that urnsamples strips x of any existing probs column before sampling.
A data frame if urn is a vector, and a list if urn is a data frame.
G. Jay Kerns gkerns@ysu.edu.
urnsamples(1:10, size = 5)
S <- cards()
urnsamples(S, size = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.