play_n_games: Play N Games

Description Usage Arguments Details Value Examples

View source: R/montyhall.R

Description

The play_n_games() function allows the user to simulate any number of games in a single function. The user must only specify how many iterations of the Monty Hall Game they want the simulation to run.

Usage

1
play_n_games(n = 100)

Arguments

This

function relies on multiple arguments to work effectively. Refore, running this function, the user must ensure they have installed the package dplyr. The function works by passing the function play_game() through an iterator where n equals the number of times the game is played. The variable results.list then compiles the results of game.outcome for the appropriate number of loops identified in the variable loop.count. These results are identified as a table of the results

Details

The play_n-game() function uses a loop simulation to run a user defined number of game iterations and returns the quantitative results. For example, if the user wishes to simulate 10,000 iterations of the game, they simply only need to change the number n to equal 10,000.

Value

results.df

Examples

1

RTrehern-ASU/montyhall documentation built on Sept. 22, 2020, 12:42 a.m.