I hope there is a better way to do this because this is a horrible hack. I made the visibility of the plot conditional on whether output$Flag is a single space and then I rendered output$Flag in a convenient place. The alternative value of output$Flag is an empty string. I made the value of output$Flag depend on input$Comp because I do not know what you want the conditionalPanel to depend on.
library(shiny)
library(ggplot2)
set.seed(3)
DF <- data.frame(Date = seq.Date(from = as.Date("2019-01-01"),
to = as.Date("2019-01-24"), by = "day"),
Company = rep(c("A", "B"), 12),
ApprovalID = sample(c("AD", "GF"), 24, replace = TRUE),
State = sample(c("NY", "CO"), 24, replace = TRUE),
Value = rnorm(24, mean = 10, sd = 3))
ui <- fluidPage(
fluidRow(
column(width = 3, selectInput("Comp", label = "Company",
choices = list("A", "B") ))
),
fluidRow(
column(width = 1, textOutput("Flag")),
conditionalPanel(condition = "output.Flag == ' '", #
column(width = 6, plotOutput("Plot"))
)
)
)
server <- function(input, output) {
Tbl <- reactive({
DF %>% filter(Company == input$Comp)
})
output$Plot <- renderPlot({
ggplot(Tbl(), aes(x = ApprovalID, y = Value)) + geom_boxplot()
})
output$Flag <- renderText({
if (input$Comp == "A") Var <- " " else Var <- ""
Var
})
}
# Return a Shiny app object
shinyApp(ui = ui, server = server)