Description Details Author(s) References Examples

This package provides utilities to calculate the probabilities of various dice-rolling events, such as the probability of rolling a four-sided die six times and getting a 4, a 3, and either a 1 or 2 among the six rolls (in any order); the probability of rolling two six-sided dice three times and getting a 10 on the first roll, followed by a 4 on the second roll, followed by anything but a 7 on the third roll; or the probabilities of each possible sum of rolling five six-sided dice, dropping the lowest two rolls, and summing the remaining dice.

Package: | dice |

Type: | Package |

Version: | 1.2 |

Date: | 2014-10-13 |

License: | GPL (>= 2) |

Although initially conceived as a utility for role-playing game calculations, functions in the `dice`

package can be used to answer questions in any dice-rolling context (e.g., calculating probabilities for the game of craps, solving problems for an introductory probability course, etc.)

The `dice`

package requires the `gtools`

package.

For a complete list of functions, use `library(help="dice")`

.

Dylan Arena <[email protected]>

The implementation for the getSumProbs function originated with the ideas presented in the following forum thread:

http://www.enworld.org/showthread.php?t=56352&page=1&pp=40

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
getEventProb(nrolls = 6,
ndicePerRoll = 1,
nsidesPerDie = 4,
eventList = list(4, 3, c(1,2)),
orderMatters = FALSE)
getEventProb(nrolls = 3,
ndicePerRoll = 2,
nsidesPerDie = 6,
eventList = list(10, 4, c(2:6, 8:12)),
orderMatters = TRUE)
getSumProbs(ndicePerRoll = 5,
nsidesPerDie = 6,
nkept = 3,
dropLowest = TRUE)
``` |

```
Loading required package: gtools
[1] 0.6445312
[1] 0.005787037
$probabilities
Sum Probability Ways to Roll
[1,] 3 0.0001286008 1
[2,] 4 0.0006430041 5
[3,] 5 0.0019290123 15
[4,] 6 0.0052726337 41
[5,] 7 0.0115740741 90
[6,] 8 0.0218621399 170
[7,] 9 0.0380658436 296
[8,] 10 0.0604423868 470
[9,] 11 0.0855195473 665
[10,] 12 0.1132973251 881
[11,] 13 0.1356738683 1055
[12,] 14 0.1485339506 1155
[13,] 15 0.1428755144 1111
[14,] 16 0.1202417695 935
[15,] 17 0.0784465021 610
[16,] 18 0.0354938272 276
$average
[1] 13.43017
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.