What I really want to do is pass a numeric output condition for generating a conditional panel. I can't seem to render an output as numeric though.
My work around was to generate a reactive using the numeric condition of interest and pass that to the conditional panel as text. However, I'm struggling with this as well.
Below is an example:
the goal being to open a conditional panel whenever the user enters a number that when multiplied by 5 is greater than 100 YES - I know I could do this by setting input$number >20 This is a simplified example of what I'm working on. The issue is using numeric OUTPUT for a conditional panel
Thanks!
Sam
library(shiny)
shinyApp(
ui = fluidPage(
fluidRow(
wellPanel(
numericInput("number", label = "Choose a Number between -100 and 100",
min = -100, max = 100, value = 0))),
fluidRow(wellPanel(textOutput("text_out"))),
fluidRow(conditionalPanel(
condition = "output.big == '1' ",
fluidRow(h1("You've selected a number larger than 20!"))))),
server = function(input, output, session){
# I want to execute a function on a numeric input
times_5<-reactive({
input$number*5
})
# I can't get the condition to work with a numeric query
# So, I run the query on the server side and generate an if/else statement
# to pass a text variable
over_100<-reactive({
if(times_5()>100){
return(1)
} else{
return(0)
}
})
output$text_out<-renderText({
paste("This is text out put of the number ", input$number, "multiplied by 5 to equal ", times_5(), over_100())
})
# I can't find a render function that generates numeric output
# Even still this outputtext doesn't seem to work in the conditional statement.
output$big<-renderText({
over_100
})
}
)