Learn R Programming

ds4psy (version 0.7.0)

dice_2: Throw a questionable dice (with a given number of sides) n times.

Description

dice_2 is a variant of dice that generates a sequence of events that represent the results of throwing a dice (with a given number of sides) n times.

Usage

dice_2(n = 1, sides = 6)

Arguments

n

Number of dice throws. Default: n = 1.

sides

Number of sides. Default: sides = 6.

Details

Something is wrong with this dice. Can you examine it and measure its problems in a quantitative fashion?

See Also

Other sampling functions: coin(), dice(), sample_char(), sample_date(), sample_time()

Examples

Run this code
# NOT RUN {
# Basics:
dice_2()
table(dice_2(100))

# 10-sided dice:
dice_2(sides = 10)
table(dice_2(100, sides = 10))

# Note:
dice_2(10, 1)
table(dice_2(5000, sides = 5))

# Note an oddity:
dice_2(n = 10, sides = 8:9)  # works, but 
dice_2(n = 10, sides = 9:9)  # odd: see sample() for an explanation.

# }

Run the code above in your browser using DataLab