I have a bar plot which i want to display in R shiny based on one/multiple user input selection.But it gives an error and thereby doesn't display.The code is as below:-
unique(df3_machine_region$Region)
unique(df3_machine_region$Region)
[1] "Europe" "Americas" "APAC" "Africa" "PDO" "UK"
R shiny code:-
knitr::opts_chunk$set(echo = TRUE)
library(shiny)
ui <- fluidPage(
selectInput("Region","Select Region(s)",unique(df3_machine_region$Region),multiple=TRUE),
plotOutput("Plot1")
)
server <- function(input, output) {
output$Plot1 <- renderPlot(
ggplot(df3_machine_region,aes(x=input$Region,sum_as_hours)) +
geom_bar(stat="identity", fill="steelblue")+
theme_minimal())
}
shinyApp(ui = ui, server = server)
When i run the above code,it shows this error initially:-
After that,when i select few values,it gives the below error:-