Description Usage Arguments Details Value Examples
select_door() allows the contestant to choose only one selection among the three doors that were previously created in step#1. The sample()allows from randomization each time the contestant makes his first choice.
1 |
The |
"doors" object is of a numeric nature, as it allows the contestant to choose one door from doors numbered "1, 2, 3",so the result returned after running the function "a.pick" is also a number between 1 & 3 |
Inside the select_door(), we created a number of objects in order for the contestant to be able to make one first selection. The first object assigned was the "doors <- c(1,2,3)", which uses numeric data and creates the options from which the contestant will make his first guess. The second object is "a.pick" it uses the sample(), which allows randomization while displaying the game.The sample()uses the previously assigned "doors" object and allows only for one choice by using the argument "size = 1".
The function returns a length one numeric vector indicating the contestant's first door selection
1 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.