Description Usage Arguments Details Value Examples
View source: R/monty-hall-problem.R
change_door()
returns the final contestant's decision on the door
position.
1 | change_door(stay = T, opened.door, a.pick)
|
stay |
logical vector, default to true. |
opened.door |
numeric vectors, length 1, between 1 and 3, cannot equal to a.pick. |
a.pick |
numeric vectors, length 1, between 1 and 3, cannot equal to opened.door. |
The contestant is given the option to change from their initial selection to the other door that is still closed. This function first creates a vector of doors numbered 1, 2, 3. Then if the contestant decides to stay, the function will return their final selection of the position on the door to open, which is the same as their initial choice. If the contestant switches, the returned final selection from this function would be the door that has not yet been opened nor has been not selected by the contestant.
The function returns a length 1 numeric vector indicating the contestant's final selection.
1 2 3 4 | change_door( T, 1, 2 )
change_door( F, 1, 2 )
change_door( T, 2, 3 )
change_door( F, 2, 3 )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.