play_n_games: Adding The Game To A Loop

Description Usage Arguments Details Value Examples

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

Description

We want to run simulations to gather data for inferential statistics.

Usage

1
play_n_games(n = 10000)

Arguments

The

play_n_games function calles upon the argument of a numeric vector. The library dplyr calls upon the package. The results.list function will act as a collector for atomic vectors from the loop. The loop.count will act as a counter The for loop runs the functions play.game and creates new functions to gather data and increment the counter when complete. Results are stored in results.df and put into a table and formatted with the round function.

Details

By creating a loop to run the program 10,000 tiems, we will gather enough data to make inferences upon the game strategy for each case, stay or switch.

Value

A formatted table with headers and stategy results formatted to show proportion.

Examples

1
2
3
4
      outcome
  strategy   LOSE  WIN
   stay      .67   .33
   switch    .33   .67

scribenaz/montyhall documentation built on Jan. 31, 2021, 12:48 a.m.