Text summary

The text summary function is wrapped in renderText(). This lets Shiny know that this function returns text, as shown in the following code:

output$summary = renderText({      paste0(input$year[2] - input$year[1], " years are selected. There are ",     length(unique(theData()$country)), " countries in the dataset measured at ",    length(unique(theData()$year)), " occasions.")}) 

Remember that this output is picked up in ui.R with the textOutput() function, which takes the "summary" identifier, which, as you can see, is the name given by the output$summary = renderText({...}) function. The function very simply pastes together some text and some values taken from the application.

Get Web Application Development with R Using Shiny - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.