Description Usage Arguments Details Value Examples
View source: R/monty-hall-problem.R
open_goat_door()
returns the position of a goat door that the host
reveals after the contestant's initial random decision. The host will
always open a door with a goat behind it. But the door can't be the one
the contestant has selected.
1 | open_goat_door(game, a.pick)
|
game |
character vector, length 3, any combination of one "car" and two "goat". |
a.pick |
numeric vectors, length 1, between 1 and 3. |
This function first creates a vector of doors numbered 1, 2, 3. Then if the contestant selects a car door, the function will return the position of a goat door selected by the host from any of the two remaining doors that contain the goat. If the contestant selects a non-car door at the first place, the function will return the only goat door position that left for the host.
The function returns a length 1 numeric vector indicating the goat door position that the host reveals.
1 2 3 | open_goat_door( c("goat","goat","car"), 3 )
open_goat_door( c("car","goat","goat"), 1 )
open_goat_door( c("goat","car","goat"), 2 )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.