Exercise

# Simulating spinner data

Well done! Now you know how to construct your own spinner and inspect its probability distribution.

Now you'll learn how you can use simulation to gain an understanding of your spinner.

To simulate spinning your spinner, you can use the `spinner_data()`

function, which takes as arguments the vector of regions, and the number of spins you want to simulate.

From the result, you can find the approximate fraction of spins which landed on a given value!

Instructions

**100 XP**

- Declare a variable called
`regions`

to hold a new spinner with region areas 2, 2, 4. - Simulate 1000 spins from your spinner, storing the results in the vector
`spins`

. - Using the preloaded function
`bar_plot()`

, create a bar chart of your spin results contained in`spins`

. - Construct a frequency table by passing
`spins`

to the`table()`

function. - Find the fraction of simulated spins equal to 2.
- Find the mean spin value.