In my way to learning Shiny rudiments, I do want to build a simple application that presents a ui
with boxes with different background colours based on the value of a variable calculated in server
.
I'm trying to use a classical if-statement
, being n_add_due_all
in server
:
fluidRow(
if(n_add_due_all > 0)
{box(title = "to add", background = "red")}
else
{box(title = "to add", background = "green")}
)
I've being trying to use renderUI -> uiOutput
and renderPrint -> textOutput
server/ui
pairs, but I'm not able to get a numeric value suitable for the n_add_due_all > 0
evaluation.
Please, is it doable? Is there any way of simply passing a numeric value from server
to ui
?
I found numerous related question and answers, but all of them seam much complex user-cases where some kind of interaction with user by selecting or entering values is required. In this case, the variable is completely calculated in server
and should only be recalculated upon a page reload.
Thanks for your help!