select_door: The contestant makes their first selection.

Description Usage Arguments Details Value Examples

View source: R/Montyhall.R

Description

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.

Usage

1

Arguments

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

Details

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".

Value

The function returns a length one numeric vector indicating the contestant's first door selection

Examples

1

Ma112120/Montyhall documentation built on Dec. 17, 2021, 2:14 a.m.