Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rflip

Tossing Coins


Description

These functions simplify simulating coin tosses for those (students primarily) who are not yet familiar with the binomial distributions or just like this syntax and verbosity better.

Usage

rflip(
  n = 1,
  prob = 0.5,
  quiet = FALSE,
  verbose = !quiet,
  summarize = FALSE,
  summarise = summarize
)

## S3 method for class 'cointoss'
print(x, ...)

nflip(n = 1, prob = 0.5, ...)

Arguments

n

the number of coins to toss

prob

probability of heads on each toss

quiet

a logical. If TRUE, less verbose output is used.

verbose

a logical. If TRUE, more verbose output is used.

summarize

if TRUE, return a summary (as a data frame).

summarise

alternative spelling for summarize.

x

an object

...

additional arguments

Value

for rflip, a cointoss object

for nflip, a numeric vector

Examples

rflip(10)
rflip(10, prob = 1/6, quiet = TRUE)
rflip(10, prob = 1/6, summarize = TRUE)
do(5) * rflip(10)
as.numeric(rflip(10))
nflip(10)

mosaic

Project MOSAIC Statistics and Mathematics Teaching Utilities

v1.8.3
GPL (>= 2)
Authors
Randall Pruim [aut, cre], Daniel T. Kaplan [aut], Nicholas J. Horton [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.