# Contract poll looking for &gt;=32


Find this notebook on the web at
<a class="quarto-xref" href="https://resampling-stats.github.io/edition-3-r/how_big_sample.html#nte-contract_poll_32">Note <span>30.4</span></a>.

This R notebook generates samples of 50 simulated voters on the
assumption that only 50 percent are in favor of the contract. Then it
counts the number of generated samples where 32 or more of the 50
respondents said they were in favor of the contract.

```{r}
n_trials <- 10000

yeses <- numeric(n_trials)

for (i in 1:n_trials) {
    answers <- sample(c('No', 'Yes'), size=50, replace=TRUE)
    yeses[i] <- sum(answers == 'Yes')
}

k <- sum(yeses >= 32)
kk <- k / n_trials

message('Proportion >= 32: ', round(kk, 2))
```
