play_n_games: Play a number of games

Description Usage Arguments Details Value

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

Description

1
2
 plays the full version of the games a number of times
 initially set at 100 games
1
2
 plays the full version of the games a number of times
 initially set at 100 games

Usage

1
2
3
play_n_games(n = 100)

play_n_games(n = 100)

Arguments

the

function can run for any integer of gameplays. n=100 initially sets the game at 100 plays

Details

1
2
3
4
5
6
 plays the game and stores the results in a list named
 results.list. this is repeated via a loop
 n number of times.

 the results of the games are stored in a dataframe
 called results.df
1
2
3
4
5
6
 plays the game and stores the results in a list named
 results.list. this is repeated via a loop
 n number of times.

 the results of the games are stored in a dataframe
 called results.df

Value

1
2
 the outcome of all games returned as a dataframe
 table
1
2
3
4
5
6
7
 the outcome of all games returned as a dataframe
 table. for example:

         outcome
         strategy LOSE  WIN
         stay   0.76 0.24
         switch 0.24 0.76

AmyTrumpower/montyhall documentation built on Dec. 17, 2021, 8:47 a.m.