Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(shiny)
- library(purrr)
- ui <- fluidPage(
- uiOutput("text_ui")
- )
- server <- function(input, output) {
- text_list <- c(
- "This is the first line
- and this is the second.",
- "Another text string
- consisting of two lines."
- )
- format_text <- function(text) {
- text <- stringr::str_replace_all(text, "(\r|\n)", "<br/>")
- shinydashboard::box(text, width = NULL, style = "primary", title = "text box:")
- }
- output$text_ui <- renderUI({
- map(text_list, format_text) %>%
- tagList()
- })
- }
- shinyApp(ui = ui, server = server)
Advertisement
Add Comment
Please, Sign In to add comment