change_door: Change Door Function

Description Usage Arguments Details Value Examples

View source: R/montyhall.R

Description

The change_door function is where the player makes the decision to stay with their initial choice, a.pick, or change to the other unopened door. They do not know what is behind either of the remaining closed doors.

Usage

1
change_door(stay = T, opened.door, a.pick)

Arguments

This

function contains two basic arguments. The first is that if the player decides to stay, then their initial choice a.pick becomes their final.pick. If the player decides to switch, then the host cannot select opened.door or a.pick. To perform this, the function uses the argument that final.pick is not equal to opened.door or a.pick.

Details

if the player decides to stay, then the host will move forward with opening the door associated with a.pick. If the player decides to switch doors, the host will open the third door. The third door is not a.pick or opened.door. The final choice of the player is then assigned to variable final.pick.

Value

This function returns a length one character vector that is a number between 1 and 3. That number is assigned to variable final.pick.

Examples

1

RTrehern-ASU/montyhall documentation built on Sept. 22, 2020, 12:42 a.m.