1

在服务器逻辑中定义的列表应该用于下拉列表。

下面的代码应该显示这个想法。

# 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]),
    ...
))

有可能完成这项工作吗?也许是一些纯文本输出,类似于 renderText(models)。

4

1 回答 1

4

如果选择会随着用户更改其他输入而动态更改,请在 observe() 调用中使用 updateSelectInput。

如果选择不会在单个会话过程中发生变化,但可能会从一个会话更改为下一个会话,请直接在 shinyServer 函数中使用 updateSelectInput。

如果选择永远不会改变,您可以直接在 ui.R 中计算模型——这只是您正在编写的常规 R 代码。

于 2013-12-04T17:30:40.940 回答