urn_sampler | R Documentation |
Sample red and black marbles from an urn of marbles #'
urn_sampler( red = 50, black = 50, sample_size = 25, red_proportion = NULL, urn_size = NULL, replace = TRUE, repetitions = 1, tally = FALSE )
red |
The number of red marbles in the urn. |
black |
The number of black marbles in the urn. |
sample_size |
The number of marbles to draw from the urn. |
replace |
Is the sampling with or without replacement? |
repetitions |
The number of repetitions of this sampling to be done. |
tally |
If TRUE, instead of returning the data frame of all samples, return a data frame of the number of times each combination of red and black marbles occur in the samples. |
A data frame with two columns: n_red
and n_black
, which give the
number of red and black marbles, respectively, in the sample of size
sample_size
. Each row of the data frame gives the results of the
repetition of this experiment.
urn_sampler(repetitions = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.