[英]Shiny - multiple outputs to mainPanel
Shiny似乎只接受ui.R
提供給mainPanel
的任何最終輸出。 早期的SO問題提出了這一點,但沒有達成令人滿意的解 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?")
})
)
有誰知道這是一個錯誤,或如何解決它?
嘗試
mainPanel(
# only the last output works
h1(textOutput("txt")),
plotOutput("myplot"),
p("see what I mean?")
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.