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