roll_dice | R Documentation |
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.
roll_dice( data = NULL, times = 1, rounds = 1, success = c(6), agg = FALSE, sides = 6, prob = NULL, seed = NULL )
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 |
Result of experiment as a tibble
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.