簡體   English   中英

閃亮 - 多個輸出到mainPanel

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM