change_door: Switch or stay with initial door

Description Usage Arguments Details Value Examples

View source: R/Monty Hall Script.R

Description

If the player wishes to stay with their initial door, then their initial pick is made their final pick. If the player wishes to switch to the remaining unopen door, then their final pick is made the unopened door.

Usage

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

Arguments

stay

This argument's default vaule is TRUE but can be made FALSE.

opened.door

This argument is the numeric vector of length one equal to the opened door.

a.pick

This is a numeric vector of length one equal to the player's initial door.

Details

This function determines whether or not the player wishes to stay through a logical argument. If true, then the final pick is returned as the initial pick. If false, then the position of the door that was neither the player's first choice or opened door is determined. This value is then made the player's final pick.

Value

This function returns the final pick of the player based on whether they chose to stay or switch.

Examples

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

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

dlyork/montyhall documentation built on Jan. 31, 2021, 7:22 p.m.