2017-10-16 2 views
-1

Also ich habe eine ziemlich komplizierte (zumindest für mich ist es haha) ggplot, dass ich versuche, aus diesen Daten zu erstellen.Gestapelte Balkendiagramm in ggplot aus dieser Tabelle

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) 

Ich möchte ein gestapeltes Balken ggplot zu schaffen, die Probleme auf der x-Achse hat, und dann zählen auf der y-Achse, sondern zeigt auch, wie jede Ausgabe gebrochen wird durch Auflösung nach unten. Dies ist ziemlich einfach in Excel, aber da ich andere Graphen in R mache, möchte ich die Ästhetik konsistent halten.

+0

Was haben Sie bisher versucht? – Mako212

+1

hast du schon einen 'ggplot()' code ausprobiert? scheint wie eine Coding-Service-Anfrage statt einer bestimmten Frage – Nate

Antwort

1

Versuchen:

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

Wenn das nicht der Auftrag, schalten nur die Platzierung der Ausgabe und Auflösung.

Verwandte Themen