flip_coin
From tidydice v0.0.6
by Roland Krasser
Simulating flipping a coin.
Flipping a coin is simulated using sample(). The default coin has 2 sides and is fair. The properties of the coin can be changed. The result is returned as a tibble.
Usage
flip_coin(data = NULL, times = 1, rounds = 1, success = c(2),
agg = FALSE, sides = 2, prob = NULL, seed = NULL)
Arguments
- data
Data from a previous experiment
- times
How many times coin is flipped (or how many coins are flipped at the same time)
- rounds
Number of rounds
- success
Which result is a success (default = 2)
- agg
If TRUE, the result is aggregated (by experiment, rounds)
- sides
Number of sides of the coin (default = 2)
- prob
Vector of probabilities for each side of the coin
- seed
Seed to produce reproducible results
Value
Result of experiment as a tibble
Examples
# NOT RUN {
# flipping a coin
flip_coin()
# flipping a coin 10 times
flip_coin(times = 10)
# aggregate result
flip_coin(times = 10, agg = TRUE)
# rounds
flip_coin(times = 10, rounds = 3, agg = TRUE)
# experiments
library(dplyr)
flip_coin(times = 10, rounds = 3, agg = TRUE) %>%
flip_coin(times = 12, rounds = 3, agg = TRUE)
# }
Community examples
Looks like there are no examples yet.