I am trying to add the output from a drop down list into a field in ggplot
The data fields I want to use has these fields:
The code I use to output this in a chart is:
ggplot(survey_data_sub, aes(fill=`Education level`, y=`Education level`,
x=`Developer group`)) +
geom_bar( stat="identity")
This works great for showing the Education level results.
I want to make the fill and y dynamic, from a drop down list. So I used the below shiny code:
sidebarLayout(
sidebarPanel(
selectInput("newplot_select", "Choose Breakdown for chart:",
list("UK location", "Education level", "Current
salary", "Generation"))
),
mainPanel(
textOutput("newPlot_selected_filter"),
plotOutput("newPlot")
)
)
output$newPlot <- renderPlot({
ggplot(survey_data_sub, aes(fill=input$newplot_select,
y=input$newplot_select, x=`Developer group`)) +
geom_bar( stat="identity")
})
the input$newplot_select doesent pull in the content from the dropdown list. If I just output the input$newplot_select in a text output it does print the input value. How can I do that in the ggplot code I have used?
Thank you for your help