R 闪亮-多个输出到主面板
Shiny似乎只接受提供给R 闪亮-多个输出到主面板,r,shiny,R,Shiny,Shiny似乎只接受提供给ui.R中的mainPanel的任何文件的最终输出。A提出了这一点,但没有达成令人满意的解决办法。主面板的文档表明,这应该是可能的: 描述:创建包含输出元素的主面板 以下代码说明: server.R library(shiny) shinyServer( function(input, output) { plotInput <- reactive({ list(plot = plot(1:10), txt = "My re
ui.R
中的mainPanel
的任何文件的最终输出。A提出了这一点,但没有达成令人满意的解决办法。主面板的文档表明,这应该是可能的:
描述:创建包含输出元素的主面板
以下代码说明:
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 })
}
)
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?")
})
)
有人知道这是否是一个bug,或者如何解决它吗?试试看
mainPanel(
# only the last output works
h1(textOutput("txt")),
plotOutput("myplot"),
p("see what I mean?")
)
不要这样;令人讨厌的嵌套和令人困惑的错误消息使Shining成为一次愉快的调试冒险(即使它设计巧妙)。谢谢。顺便问一下,您对从
reactive()
提供多个输出的plotInput()$plot
方法有何评论?我很想知道是否有更好的方法。。