2017-10-16 12 views
-1

このデータから作成しようとしているggplotはかなり複雑です(少なくとも私にとっては笑)。このテーブルのggplotに積み重なった棒グラフ

Issue = c("Difficulty receiving products in general", 
"Supplier compliance issues", "Supplier fraud, waste, or abuse", 
"Difficulty receiving products in general", "Difficulty receiving products in general", 
"Supplier fraud, waste, or abuse", "Supplier service issues", 
"Problems repairing due to service issues ", "Problems repairing due to service issues ", 
"Other", "Billing, coverage, coordination of benefits", "Problems repairing due to service issues ", 
"Difficulty receiving products in general", "Difficulty receiving products in general", 
"Low quantity/quality", "Difficulty receiving products in general", 
"Difficulty receiving products in general", "Supplier service issues", 
"Problems repairing due to service issues ", "Problems repairing due to service issues ", 
"Problems repairing due to service issues ", "Problems repairing due to lack of inventory ", 
"Supplier service issues", "Difficulty receiving products in general", 
"Supplier service issues") 

Resolution = c("Current supplier resolved the issue", 
"Current supplier resolved the issue", "Current supplier resolved the issue", 
"Supplier educated about inquiry\n", "Beneficiary educated about inquiry ", 
"Supplier educated about inquiry\n", "Beneficiary educated about DMEPOS\n", 
"Beneficiary educated about inquiry ", "Beneficiary educated about inquiry ", 
"Beneficiary educated about inquiry ", "Beneficiary educated about suppliers", 
"The case unresolved ", "The case unresolved ", "Beneficiary educated about DMEPOS\n", 
"Current supplier resolved the issue", "Current supplier resolved the issue", 
"Beneficiary educated about DMEPOS\n", "Beneficiary educated about suppliers", 
"New supplier found ", "Beneficiary educated about suppliers", 
"Supplier educated about inquiry\n", "New supplier found ", 
"New supplier found ", "Beneficiary educated about DMEPOS\n", 
"The case unresolved ") 

df <- data.frame(Issue,Resolution) 
crosstable<- table(df$Issue,df$Resolution) 

私は、x軸上の問題を持って積上げ棒ggplotを作成し、y軸にカウントしたいのですが、また、それぞれの問題が解決によって分解される方法を示しています。これはExcelで行うのはかなり簡単ですが、私はRで他のグラフを作っているので、美しさを一致させたいと思います。

+0

これまでに何を試しましたか? – Mako212

+1

まだ 'ggplot()'コードを試してみましたか?特定の質問ではなくコーディングサービスのリクエストのようです – Nate

答えて

1

試してみてください。

ggplot(df, aes(Issue, fill = Resolution)) + geom_bar() 

それが順序ではない場合は、単に問題と解決の配置を切り替えます。

関連する問題