I am new to shiny . when I run these codes :
UI:
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Hi"),
sidebarPanel(selectInput('variable','parameter:',list('mipigi'='mpg',"cylender"='cyl',"displacement"='disp',"horsepower"='hp'))
),
mainPanel(
h3(textOutput("caption")),
plotOutput("histo")
)
))
Server:
library(shiny)
library(datasets)
shinyServer(function(input,output){
formulaText <- reactive({
paste("qsec~", input$variable)
})
output$caption <- renderText({
formulaText()
})
output$histo<-renderPlot({
plot(as.formula(formulaText),mtcars)
})
}
)
When I run it , I got the error :
Error:object of type 'closure' is not subsettable