-2

How would I make this a horizontal bar chart in R where the x axis has the counts and the y axis has the labels, I know this seems easy but ggplot doesnt let you input table data

>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  
  • Possible duplicate of [Horizontal Barplot in ggplot2](https://stackoverflow.com/questions/10941225/horizontal-barplot-in-ggplot2) – acylam Aug 09 '17 at 20:09

1 Answers1

1

Try 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()
submartingale
  • 715
  • 7
  • 16