Question

A list that is defined in the server logic should be used for a drop down.

The following code should show the idea.

# server.R
shinyServer(function(input, output, session) {
    output$models <- c("a","b","c")
    ...
})


#ui.R
require(rCharts)
...
shinyUI(pageWithSidebar(
    ...
    sidebarPanel(
    selectInput("select", "Your choice:", [models]),
    ...
))

Is it possible to make this work? Maybe some plain text output, similar to renderText(models).

Was it helpful?

Solution

If the choices will change dynamically as the user changes other inputs, use updateSelectInput in an observe() call.

If the choices will not change over the course of a single session but may change from one session to the next, use updateSelectInput directly in the shinyServer function.

If the choices will never change, you can calculate the model directly in ui.R--it's just regular R code you're writing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top