I would like Shiny to print out some different color text depending on the size of a vector. I was thinking something like:
output$some_text <- renderText({
if(length(some_vec) < 20){
paste("This is red text")
<somehow make it red>
}else{
paste("This is blue text")
<somehow make it blue>
...but then I realized, I'm doing this in the server, not the UI.
And, as far as I know, I can't move this conditional logic into the UI.
For example, something like this won't work in the UI:
if(length(some_vec)< 20){
column(6, tags$div(
HTML(paste("This text is ", tags$span(style="color:red", "red"), sep = ""))
)}
else{
tags$div(HTML(paste("This text is ", tags$span(style="color:blue", "blue"), sep = ""))
)}
Does anyone have any creative ideas?
, header classes, ect. that you want, so to compose some more interesting conditional outputs. I've used it quite a bit now in apps now that it's clear its an option. – Nathan Brown Jun 16 '17 at 21:46