coin3 <- data.frame(
N_Heads = c(0, 1, 2, 3),
C_Heads = c(1, 3, 3, 1)
)
attach(coin3)
coin3$P_Heads <- C_Heads/sum(C_Heads)

options(repr.plot.width=7, repr.plot.height=4)
barplot(coin3$P_Heads, names = coin3$N_Heads, main = "Discrete Probability Distribution of flipping three coins")

attach(coin3)
E_X = sum(N_Heads * P_Heads)
E_X

```
The following objects are masked from coin3 (pos = 3):
C_Heads, N_Heads
```