如何在R中将其设为水平条形图,其中x轴具有计数,y轴具有标签,我知道这看起来很简单,但ggplot不允许您输入表格数据
>table(df$Primary.Issue.Category)
Billing, coverage, coordination of benefits Concern over standard receipt time Difficulty finding new supplier Difficulty receiving products in general
6 1 4 89
Difficulty receiving specific products Low quantity/quality Problems repairing due to service issues Supplier compliance issues
3 10 9 8
Supplier fraud, waste, or abuse Supplier service issues
2 4
答案 0 :(得分:1)
尝试coord_flip()
:
df<-as.data.frame(table(df$Primary.Issue.Category))
names(df)<- c("labels", "counts")
ggplot(df, aes(x=labels, y=counts)) +
geom_bar(stat='identity') +
coord_flip()