Description Usage Arguments Details Value Examples
View source: R/monty-hall-problem.R View source: R/monty-hall-problem.R
1 2 3 | opens a door not selected by the contestant
or a car to reveal a goat. This leaves 2 doors
unopened
|
1 | open_goat_door(game, a.pick)
|
arguments |
in this function are: game: randomly assigns goat, goat, and car to doors 1,2,&3 a.pick: randomly assigned integer of 1,2, or 3 as the contestant's first pick |
1 2 3 4 5 6 7 8 9 10 | this function first checks if the contestant's
pick is a car by using an IF statement.
If the contestant has selected the car then the
function will randomly select one of the remaining
doors to reveal a goat.
If the contestant has selected one of the two doors
with a goat, the function places a number (1,2,or3)
that does not contain car or the contestant's pick
into opened.door
|
1 2 3 4 5 |
1 2 3 4 | returns one of the following:
[1] 1
[1] 2
[1] 3
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.