pmdaly
pmdaly

Reputation: 1222

How to display Text + rendered text horizontally in a textbox?

I want to create a column of 3 small text boxes each with a static string and a rendered value like "max: 153". This is what I currently have.

# ui.R
...
verbatimTextOutput("var1_max"),
varbatimTextOutput("var1_min")
....

# server.R
...
output$var1_max <- renderText({ max(df()$feature })
output$var1_min <- renderText({ min(df()$feature })
...

this will get me the text boxes with value only and I can get info boxes with icons but I just want a small box that says "Min: 'var1_min' " and another with "Max: 'var2_max' " but it's not clear to me how to add the text.

Upvotes: 0

Views: 940

Answers (1)

Rorschach
Rorschach

Reputation: 32466

You can use paste or sprintf, etc. to create text with variables substituted in. For example,

output$var1_max <- renderText({ paste("Max:", max(df()$feature)) })

Or, if you want the "Max:" to not be rendered, maybe something using fluidRow

fluidRow(
    column(width=1, "Max:"),
    column(width=1, verbatimTextOutput("var1_max"))
)

Upvotes: 1

Related Questions