Description Usage Arguments Details Value Examples
View source: R/monty-hall-problem.R
This block of code will randomly select ONE of the three doors and return the result as the selection.
1 |
The |
select_door function calls upon a generic function with no arguments. The doors function uses logical vectors 1-3. The a.pick function uses the sample function to randomly generate a logical vector taken from the doors function. |
Since the contestant will not know the position of the car when they select a door, we do not need to share the information about the game set-up before the selection is made. We will create a vector containing three integers to represent a door number.
The function returns a length three character vector that will represent the door number. The vectors can only be : 1, 2, or 3
1 2 3 | 1
2
3
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.