I am trying to create/ learn an interactive box plot through Shiny, below id the code i m trying to use. This gives me the error
Warning: Error in model.frame.default: variable lengths differ (found for 'input$p')
[No stack trace available]
I am unable to figure this out, any help would be much appreciated
CODE:
library(shiny)
ui <- fluidPage(
selectInput("p","p",choices = names(mtcars)),
plotOutput("myplot"))
server <- function(input, output, session) {
output$myplot <- renderPlot({
boxplot(mpg ~ input$p , data=mtcars)
})
}
shinyApp(ui, server)