我正在关注此链接:ggplot2 bar plot with two categorical variables
我的问题非常相似 - 我需要做OP需要的但我需要用另一个因素来分割计数条 .
让我说明一下:
> var response_cat has values 0,1 (categories of a response)
>
> var group indicates belonging to a group (0,1)
>
> var item indicates the name of an item (20 strings with codes like LY1, GN6,...)
我需要绘制如下图形:x轴每个项目有两个条形(对于每个组),y轴的相对频率为1
有任何想法吗?
谢谢!
1 回答
我们可以用
facet_wrap
数据