powered by
These functions simplify simulating coin tosses for those (students primarily) who are not yet familair with the binomial distributions or just like this syntax and verbosity better.
rflip(n = 1, prob = 0.5, quiet = FALSE, verbose = !quiet)# S3 method for cointoss print(x, ...)nflip(n = 1, prob = 0.5, ...)
# S3 method for cointoss print(x, ...)
nflip(n = 1, prob = 0.5, ...)
the number of coins to toss
probability of heads on each toss
a logical. If TRUE, less verbose output is used.
TRUE
a logical. If TRUE, more verbose output is used.
an object
additional arguments
for rflip, a cointoss object
rflip
for nflip, a numeric vector
nflip
# NOT RUN { rflip(10) rflip(10, prob=1/6, quiet=TRUE) do(5) * rflip(10) as.numeric(rflip(10)) nflip(10) # }
Run the code above in your browser using DataLab