I want to output multiple lines of text using one renderText()
command. However, this does not seem possible. For example, from the shiny tutorial we have truncated code in server.R
:
shinyServer(
function(input, output) {
output$text1 <- renderText({paste("You have selected", input$var)
output$text2 <- renderText({paste("You have chosen a range that goes from",
input$range[1], "to", input$range[2])})
}
)
and code in ui.R
:
shinyUI(pageWithSidebar(
mainPanel(textOutput("text1"),
textOutput("text2"))
))
which essentially prints two lines:
You have selected example
You have chosen a range that goes from example range.
Is it possible to combine the two lines output$text1
and output$text2
into one block of code? My efforts so far have failed, e.g.
output$text = renderText({paste("You have selected ", input$var, "\n", "You have chosen a range that goes from", input$range[1], "to", input$range[2])})
Anyone have any ideas?