【发布时间】:2018-02-16 12:45:08
【问题描述】:
标题基本上是这样说的。对于复杂的 Shiny App,我必须能够将 NULL 值发送到 renderPlotly(),因为我只想在满足某些条件时才显示绘图。普通的shiny::renderPlot() 能够做到这一点。
一个给出我不想要的错误的小例子:
library(shiny)
library(plotly)
ui <- fluidPage(
plotlyOutput("plotly"),
plotOutput("plot")
)
server <- function(input, output) {
# I need to be able to put NULL in here or anything so that
# there is no output and also no error message.
output$plotly <- renderPlotly({
NULL
})
# This works and sends no error message
output$plot <- renderPlot({
NULL
})
}
shinyApp(ui, server)
请注意,Web 应用程序仅显示一条错误消息,即来自 renderPlotly() 的一条错误消息。
我正在寻找任何解决方法。如何在应用程序的同一位置显示的这两个图之间切换,并始终忽略其中一个,具体取决于其他输入?
【问题讨论】:
-
以前没见过这个。条件面板可以从服务器功能访问对象吗?意思是,我可以访问从服务器呈现的条件吗?
-
我认为这是可能的。看这里:stackoverflow.com/questions/41710455/….