So I'm having some trouble with this question. I conceptually understand what I'm trying to do, but I'm not sure how to make it happen. Essentially, I want to create a tibble that flips a coin 6 times and returns how many times it flipped heads. The twist is that the coin may or may not be fake and this is represented by 5 probabilities for heads (.00, .25, .50, .75, 1). Also I have priors for each of these probabilities.

To tackle this question I created a tibble that samples from my five probabilities with the priors written in the prob section. Then I try and use mutate to create a number_heads column that should show how many heads were flipped that also correspond to my p column. I try and use case_when to then create five different samples that match the probabilities from earlier. I'm not getting anywhere with this approach though.

I know this strategy worked for me when I only had to probabilities and I used an if_else command. But now that I have 5, I'm hitting a wall. Hopefully this makes sense.

Thanks in advance.

```
Q2 <- tibble(replicate = 1:1000) %>%
mutate(p = sample(c("0.00", "0.25", ".50", ".75", "1.00"), size = 1000, replace = TRUE, c(.25, .05, .4, .05, .25))) %>%
mutate(
number_heads = case_when(
sample(c(0, 1, 2, 3, 4, 5, 6), size = 1000, replace = TRUE, prob = c(1, 0, 0, 0, 0, 0, 0)) ~ "0.00",
sample(c(0, 1, 2, 3, 4, 5, 6), size = 1000, replace = TRUE, prob = c(0.1779785, 0.355957, 0.2966309, 0.1318359, 0.03295898, 0.004394531, 0.0002441406)) ~ "0.25",
sample(c(0, 1, 2, 3, 4, 5, 6), size = 1000, replace = TRUE, prob = c(0.015625, 0.09375, 0.234375, 0.3125, 0.234375, 0.09375, 0.015625)) ~ "0.50",
sample(c(0, 1, 2, 3, 4, 5, 6), size = 1000, replace = TRUE, prob = c(0.0002441406, 0.004394531, 0.03295898, 0.1318359, 0.2966309, 0.355957, 0.1779785)) ~ "0.75",
sample(c(0, 1, 2, 3, 4, 5, 6), size = 1000, replace = TRUE, prob = c(0, 0, 0, 0, 0, 0, 1)) ~ "1.00",
TRUE ~ NA
))
```