Skip to content

Instantly share code, notes, and snippets.

@tommyhuang1
Created February 5, 2017 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommyhuang1/dcfe0d3e9f98c721d5d92aa8c37bbe54 to your computer and use it in GitHub Desktop.
Save tommyhuang1/dcfe0d3e9f98c721d5d92aa8c37bbe54 to your computer and use it in GitHub Desktop.
#ui.R
menuSubItem("Substance Abuse/Mental Health-Related Indicators",tabName = "SubstanceAbuseMentalHealthIndicators",icon = icon("bar-chart"))
tabItem(tabName = "SubstanceAbuseMentalHealthIndicators",
h3("Substance Abuse Mental Health Mortality"),
fluidRow(column(12,plotOutput("DrugSuicideMortality"))),
br(),
h3("Substance Abuse Mental Health Hospitalizations"),
fluidRow(column(12,plotOutput("DrugRelatedHospitalizations"))))
#server.R
output$DrugSuicideMortality<-renderPlot(
ggplot(SAM1,aes(x=factor(Race_Ethnicity),y=Mortality)) + facet_wrap(~MortalityType) +
geom_bar(stat="identity",aes(fill = factor(Race_Ethnicity))) + guides(fill=guide_legend(title = "Race Ethnicity")) +
theme(strip.text = element_text(size=15)) + xlab('Race Ethnicity') + ylab('Mortality per 100,000 Population') +
theme(plot.title = element_text(size = 15, face = "bold"))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment