urn_sampler: Sample red and black marbles from an urn of marbles #'

View source: R/urns.R

urn_samplerR Documentation

Sample red and black marbles from an urn of marbles #'

Description

Sample red and black marbles from an urn of marbles #'

Usage

urn_sampler(
  red = 50,
  black = 50,
  sample_size = 25,
  red_proportion = NULL,
  urn_size = NULL,
  replace = TRUE,
  repetitions = 1,
  tally = FALSE
)

Arguments

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.

Value

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.

Examples

urn_sampler(repetitions = 5)

mark-andrews/isdsr-pkg documentation built on Sept. 13, 2022, 11:47 p.m.