Learn R Programming

prob (version 1.0-1)

rolldie: Rolling a Die

Description

Sets up a sample space for the experiment of rolling a die repeatedly.

Usage

rolldie(times, nsides = 6, makespace = FALSE)

Arguments

times

number of rolls.

nsides

number of sides on the die.

makespace

logical.

Value

A data frame, with an equally likely probs column if makespace is TRUE.

Details

The function uses expand.grid() to generate all possible rolls resulting from the experiment of rolling a die. Sides on the die are 1:nsides. Columns of the data frame are called X1, X2, up to Xtimes

See Also

tosscoin

Examples

Run this code
# NOT RUN {
rolldie(2)
rolldie(3, nsides = 4)
rolldie(3, nsides = 4, makespace = TRUE)
# }

Run the code above in your browser using DataLab