如何在条形图中实现“差距”,如下所示:
我试图在列联表中创建一个空列,但不能。
示例数据:
groups = c("A", "B")
choices = c("orange", "apple", "beer")
dat <- data.frame(
group = rep(groups, c(93, 94)),
choice = factor(c(
rep(choices, c(51, 30, 12)),
rep(choices, c(47, 29, 18))
),
levels = choices
)
)
barplot(table(dat), beside = TRUE)