Calculating total winnings in R | Calculation using vector | Question 3
To understand this question please read form this question first, because it is linked
Based on the previous analysis, it looks like you had a mix of good and bad days. This is not what your ego expected, and you wonder if there may be a very tiny chance you have lost money over the week in total?
A function that helps you to answer this question is sum(). It calculates the sum of all elements of a vector. For example, to calculate the total amount of money you have lost/won with poker you do:
total_poker <- sum(poker_vector)
Instruction
- Calculate the total amount of money that you have won/lost with roulette and assign to the variable
total_roulette. - Now that you have the totals for roulette and poker, you can easily calculate
total_week(which is the sum of all gains and losses of the week). - Print out
total_week.