【发布时间】:2014-12-09 15:36:14
【问题描述】:
Shiny 似乎只接受在ui.R 中提供给mainPanel 的任何最终输出。 earlier SO question 提出了这个问题,但没有达到令人满意的解决方案。 mainPanel 的文档表明这应该是可能的:
描述:创建一个包含输出元素的主面板
以下代码说明:
server.R
library(shiny)
shinyServer(
function(input, output) {
plotInput <- reactive({
list(plot = plot(1:10),
txt = "My reactive title")
})
output$myplot <- renderPlot({ plotInput()$plot })
output$txt <- renderText({ plotInput()$txt })
}
)
ui.R
require(shiny)
pageWithSidebar(
headerPanel("Multiple outputs to mainPannel"),
sidebarPanel(),
mainPanel({
# only the last output works
h1(textOutput("txt"))
plotOutput("myplot")
p("see what I mean?")
})
)
有谁知道这是否是一个错误,或者如何解决它?
【问题讨论】: