Thank you Gal so much. I tried it and it worked. You are right, it was busy because of the number of groups(medications). I really appreciate it.

 

From: UF R Users List <[log in to unmask]> on behalf of "Ben-Chanoch,Gal" <[log in to unmask]>
Reply-To: UF R Users List <[log in to unmask]>
Date: Thursday, October 4, 2018 at 11:11 AM
To: "[log in to unmask]" <[log in to unmask]>
Subject: Re: Suggestion on visualization trends

 

yearly_overall_shands<-yearly %>%

  group_by(YEAR,MEDICATION) %>%

  summarise(Total = sum(UNIQUE_PT_COUNT)) %>%

  arrange(desc(Total))

trend_overall_shands<-ggplot(data = yearly_overall_shands, aes(x = factor(MEDICATION), fill = factor(YEAR), y = Total)) +       

  geom_bar(position="dodge",stat="identity") + 

  coord_flip()

trend_overall_shands

This list strives to be beginner friendly. However, we still ask that you PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.