我有一个闪亮的应用程序,我想在其中打印多个表格。问题是,我事先不知道会有多少个表格 - 这取决于数据。例如,如果变量“X”有5个级别,则我希望输出5个表格 - 每个变量级别一个表格。
为了生成表格,在
如果我在
但我还必须在
我需要为每个表单都写一个
为了生成表格,在
server.R
中的renderTable()
内调用一个函数,并将其分配给output
插槽,如下所示:output$tablePyramid <- renderTable ({
tableGeneratingFunction(argument1, argument2, ...)
})
如果我在
renderTable()
中放置了多个"tableGeneratingFunction",它只会返回最后生成的表格。所以似乎每个output
插槽只能有一个表格。我想我可以在server.R
文件中处理这个问题,根据需要动态地分配尽可能多的output
插槽。但我还必须在
ui.R
文件中列出所有的输出。以下是两个表格的示例摘录:mainPanel(
tabsetPanel(
... some code
tabPanel(title="Proportions",
tableOutput("tablePyramid"),
tableOutput("tablePyramid2")
),
... some more code
我需要为每个表单都写一个
tableOutput
函数吗?还是有更好的办法,因为我事先不知道我需要多少个tableOutput
?