rflip | R Documentation |
Flip a coin 2000 times or fewer.
rflip(n = 1, prob = 0.5, quiet = FALSE, verbose = !quiet)
## S3 method for class 'cointoss'
print(x, ...)
n |
Integer. The number of times to flip the coin. |
prob |
Number between 0 and 1. The probability of getting a "head". Default value is 0.5. |
quiet |
Logical. Should a message be printed with the output? Default is
|
verbose |
Logical. The opposite of quiet from above. Should a message be
printed? Default value is |
x |
an object |
... |
additional arguments |
# Basic usage. Note the printed output.
rflip()
# The printed output can be turned off using either method:
rflip(quiet = TRUE)
rflip(verbose = FALSE)
# Flip an unfair coin many times
flips <- rflip(100, prob = 0.35)
flips
# The actual output is embedded as an attribute
attr(flips, "sequence")
# Create a bargraph of the output
flips_output <- attr(flips, "sequence")
bargraph(~flips_output)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.