You can also do it by rendering text. UI:
shinyUI(
fluidPage(
# Application title
titlePanel("Test"),
sidebarLayout(
sidebarPanel(
actionButton("ShowCond", "Show Conditional Panel"),
conditionalPanel(
condition = "output.test=='5'",
actionButton("CheckFile", "Check file")
)
),
mainPanel(
verbatimTextOutput("test")
)
)
)
)
Server:
shinyServer(function(input, output, session) {
var <- eventReactive(input$ShowCond, {
5
})
output$test <- renderText({
var()
})
})
The catch is here that it doesn't work without the verbatimTextOutput. You need to include it somewhere on your UI side. However, you could reuse it as a message.
EDIT:
It is also possible without the verbatimtext. By default Shiny suspends all output when they are not displayed. However, this can be changed by setting the following option for a specific output variable:
outputOptions(output, "test", suspendWhenHidden=FALSE)
In this case, there is nor more need to use verbatimtext (and the corresponding rendertext).
Source: https://shinydata.wordpress.com/2015/02/02/a-few-things-i-learned-about-shiny-and-reactive-programming/#use-of-isolate-to-prevent-accidental-dependencies
condition = "input.action % 2 == 0"
, so my question is really restricted to this: can I passvalues$cond
to conditionalPanel, yes or no? Thanks! – PatrickTsession$sendCustomMessage
– jdharrison