With reactives, you must wrap the code that's using your inputs in a reactive
block, but you must set the output
values outside of it. In this case, your example should be
shinyUI(pageWithSidebar(
headerPanel("Fruits and vegetables!"),
sidebarPanel(
helpText("What do you see below?"),
#imageOutput(outputId="images/1.png")
numericInput("obs", "Number of observations to view:", 10),
actionButton("get", "Get")
),
mainPanel(textOutput("text"))
))
shinyServer(function(input, output, session) {
dt <- reactive({
paste("You have selected", input$obs)
})
output$text <- renderText({ dt() })
})
To use the imageOutput
dynamically, you should provide more information about how you want the image URL to be selected from the input.