29 lines
763 B
R
29 lines
763 B
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/combineDice.R
|
|
\name{combineDice}
|
|
\alias{combineDice}
|
|
\title{Combine Dice}
|
|
\usage{
|
|
combineDice(x, y, fun)
|
|
}
|
|
\arguments{
|
|
\item{x}{A die}
|
|
|
|
\item{y}{A die}
|
|
|
|
\item{fun}{A function that takes two vectors containing the possible
|
|
combinations of die rolls of \code{x} and \code{y}; the output should be of
|
|
the same length. Example - \code{pmax} is such a function and is used to
|
|
take the maximum of two rolls.}
|
|
}
|
|
\value{
|
|
A new die with the possible possibilities and their corresponding
|
|
probabilties
|
|
}
|
|
\description{
|
|
This function is a way to combine two independent dice rolls into a new die.
|
|
}
|
|
\examples{
|
|
summed.die <- combineDice(d4, d6, `+`)
|
|
advantaged.die <- combineDice(d4, d4, pmax)
|
|
}
|