【发布时间】:2015-02-09 03:56:28
【问题描述】:
我有一张如下所示的表格:
City Browser Device Channel Category
A IE mobile International Fashion
A safari mobile Link Furniture
B chrome desktop Link Fashion
B opera tablet Direct Gift
C IE desktop Direct Health
C Kindle console Email Health
C Chrome console Email Fashion
我需要得到每个子标题的频率与主标题 Category:
Category Sub Category Variable Value
Health Device mobile 25%
Health Device console 40%
Health Device desktop 25%
Health Device tablet 10%
Health Channel International 80%
Health Channel Direct 20%
Fashion
Gift
其他类别依此类推。发布这个我想创建一个基于Category 和每个子类别的分段条形图。如果我没有得到频率,计数很好,因为我可以在 ggplot 中转换为频率。
【问题讨论】:
标签: r ggplot2 multiple-columns plyr frequency