Description Usage Arguments Details Value Examples
View source: R/monty-hall-problem.R
‘change_door()' generates the contestant’s final pick. They can iether stay with their first pick, or change with the last unopened door.
1 | change_door(stay = T, opened.door, a.pick)
|
'stay' |
- This tells the function if the contestant stayed with their initial pick or not. 'opened.door' - This tells the function which door was opened. ‘a.pick' - This tells the function what the contestant’s inital door pick was. |
This function uses if statements that determine if the contestant stayed or changed doors. If the contested stayed, then it turns the contestants inital door pick into a final pick that is returned. If the contestant did not stay, then it passes the final unopened door into the final pick and returns that door instead.
The functions returns a number between 1 and 3 that represents the contestants final door pick.
1 2 | change_door( stay=T, opened.door, first.pick )
change_door( stay=F, 3, 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.