Description Usage Arguments Details Value Examples
View source: R/monty-hall-problem.R
We want to run simulations to gather data for inferential statistics.
1 | play_n_games(n = 10000)
|
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. |
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.
A formatted table with headers and stategy results formatted to show proportion.
1 2 3 4 | outcome
strategy LOSE WIN
stay .67 .33
switch .33 .67
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.