ui.R

The ui.R file to display dynamic info boxes is similar to the function we already saw to display static info boxes, except now the function is infoBoxOutput(). Putting all four info boxes together, we now get the following:

fluidRow( infoBoxOutput(width = 3, "infoYears"), infoBoxOutput(width = 3, "infoLifeExp"), infoBoxOutput(width = 3, "infoGdpPercap"), infoBox(width = 3, "Shiny version", "1.1.0", icon = icon("desktop"))) 

As elsewhere, in each case infoBoxOutput() is given a string (infoYears), which refers to the name of the corresponding output element (output$infoYears).

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.