change_door: Changing doors - Function

Description Usage Arguments Details Value Examples

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

Description

This function will allow the contestant to change their first pick if they wanted to.

Usage

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

Arguments

The

function "if" will help to run different commands depending on the contestant choice. If the contestant selects to "stay" then his previous pick will be remain the same (and will be a final pick). If the contestant chooses to change the door then the function "if" will run the code to choose a different door from the remaining ones, and this will be his final pick.

Details

This function will be using the variables "stay", "opened door", and the "a.pick", this variable was previously used in the previous function. The contestant will decide if they want to stay or get another pick.

Value

The function will be returning the final pick of the contestant, (either if it is still their first choice o a new choice).

Examples

1

sandralili/montyhall documentation built on Dec. 22, 2021, 10:14 p.m.