play_n_games: Simulate the Monty Hall Problem game.

Description Usage Arguments Details Value Examples

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

Description

play_n_games() simulates the game by n rounds/ default at 100 and generates the strategy table with the probability of stay or switch to the respective chance on win or lose.

Usage

1
play_n_games(n = 100)

Arguments

n

numeric vectors, length 1, default at 100

Details

The function will create a list to document the game result with a loop by n rounds, append each additional game result to the list according to the index position. and transform the list into a table with row proportions rounded to the second decimal digits.

Value

The function returns a 2 by 2 data frame indicating the probability of win or lose for stay and switch strategies.

Examples

1

lghb2005/montyhall documentation built on Jan. 30, 2021, 12:46 a.m.