open_goat_door: Opens an unselected door with a goat behind it.

Description Usage Arguments Details Value Examples

View source: R/monty-hall-problem.R

Description

'open_goat_door()' generates a number between 1 and 3 representing a door with a goat behind it and not the door that was selected by the contestant.

Usage

1
open_goat_door(game, a.pick)

Arguments

''game'

and 'a.pick' are passed into the function. 'game' holds the info on which door hold either a goat or car. 'a.pick' is the chosen door by the contestant.

Details

This function uses 'if' statements to first determine if the contestant selected the car. If he did select the car, then a random goat door is opened. If the contestant chose a goat door, then the other goat door is opened.

Value

The function returns numerical value representing an open door with a goat behind it.

Examples

1
2
  open_goat_door( new.game, first.pick )
  open_goat_door( c("goat", "car", "goat"), 2 )

Vodkard/montyhall documentation built on Feb. 27, 2020, 12:42 a.m.