You now understand how to simulate the rolling of two six-sided die and how to obtain the sum of the two die values. Using the “expand.grid” function in R you calculated the possible outcomes for rolling various combinations of die such as rolling a six-sided die with a four-sided die.
In this activity, you will investigate the outcomes of rolling two four-sided die with one big difference. Instead of adding the two die values to obtain their sum you will multiply the two die values to obtain their product.
Modify your die rolling function to return the results of MULTIPLYING the two die values together instead of adding them.
Use your new function to roll two FOUR-SIDED die containing only the values 1, 2, 3, and 4. Replicate 10,000 rolls of the four-sided die and plot the results in a histogram.
Document your code and the histogram in an HTML R Markdown document and submit the HTML file for this assignment.
Hint: Notice that the sample function returns a vector consisting of multiple values. Research how you may access the individual values of an R vector.