data(alcohol)
part_i <- alcohol %>%
summarize(pct_abuse = 100 * mean(abuse), pct_emp = 100 * mean(employ)) %>%
round(digits = 2)
part_i
## pct_abuse pct_emp
## 1 9.92 89.82
employ_abuse <- alcohol %>%
group_by(abuse) %>%
summarize(pct_emp = mean(employ)*100) %>%
round(digits = 2)
employ_abuse
## # A tibble: 2 × 2
## abuse pct_emp
## <dbl> <dbl>
## 1 0 90.1
## 2 1 87.3
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.