Description Usage Arguments Details Value Examples
determine_winner()is used along with the if()to determine whether the contestant has won the game or not based on his final pick
1 | determine_winner(final.pick, game)
|
The |
game[final.pick] is a character vector because it contains character values, as the contestant only has to either choose a "car" door or a "goat" door. |
the determine_winner()uses the if() because based on the result we can tell whether the contestant has won or not. It uses the game argument, which is a character vector. It states that if the contestant's final choice was the car door, so the returned result will be "win". If the the contestant's final choice was a a goat door, the returned result will be "lose".
The function returns a length of one character vector indicating whether the contestant has won or not.
1 2 3 4 | this.game <- c("goat","car","goat")
determine_winner( final.pick=1, game=this.game )
determine_winner( final.pick=2, game=this.game )
determine_winner( final.pick=3, game=this.game )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.