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).

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top