【发布时间】:2013-09-26 19:24:09
【问题描述】:
我正在尝试构建一个接收数据文件名的 Shiny 接口,然后运行一个生成 4 个表(矩阵)的 .R 脚本,并在 Shiny 中一次将它们全部输出。例如:
ui.R
shinyUI(pageWithSidebar(
headerPanel("Calculate CDK fingerprints"),
sidebarPanel(
textInput("text_input_fingerprints", "Enter smiles file name:"),
actionButton("runButton", "Run")
),
mainPanel(
tableOutput("cdk")
)
)
)
服务器.R
shinyServer(function(input,output){
output$cdk <- renderTable({
input$runButton
if (input$runButton == 0) {return()}
else{
source('calculate_cdk_fingerprints.R', local = TRUE)
print(table1)
print(table2)
print(table3)
print(table4)
}
})
})
不幸的是,Shiny 只打印最后一个表,即表 4。而且我不能真正拆分 .R 脚本,因为它还会将一些文件输出到本地文件夹。是的,我真的需要使用 actionButton()。
有什么建议吗?提前致谢!
【问题讨论】:
-
你试过为每个表单独调用 renderTable() 吗?