# NOT RUN {
f_affirm(c(TRUE, TRUE, FALSE))
f_affirm(c(1, 1, 0, 1, 0, 0, NA))
f_affirm(c(1, 0, 2, .3, -3))
f_affirm(rnorm(20) > 0)
f_affirm(rnorm(20) > 0, "A", "B")
# }
# NOT RUN {
library(ggplot2)
library(dplyr)
## Without labels
data_frame(dummy = sample(c(TRUE, FALSE), 30, TRUE)) %>%
count(dummy) %>%
ggplot(aes(dummy, n)) +
geom_bar(stat = 'identity')
## With labels
data_frame(dummy = sample(c(TRUE, FALSE), 30, TRUE)) %>%
count(dummy) %>%
ggplot(aes(dummy, n)) +
geom_bar(stat = 'identity') +
scale_x_discrete(labels = f_affirm)
# }
Run the code above in your browser using DataLab