【发布时间】:2021-11-12 10:18:26
【问题描述】:
我有一个简单的应用程序,我想在其中弹出一个文本,但由于文本很长,我想添加换行符。出于某种原因,即使我添加了
,R 也无法识别我的换行符,就像我在 example 中读到的那样。
任何帮助将不胜感激!
library(shiny)
long_text <- paste0(htmltools::HTML("I have a lot of text. <br><br>And I want it on different lines.<br><br> This should work, but R is being....<br><br>difficult."))
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
br(),
actionButton(inputId = "text_info",
label = "My R Sob Story", style = "color: #FFFFFF; background-color: #CA001B; border_color: #CA001B")
),
mainPanel(
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
observeEvent(input$text_info, {
showModal(modalDialog(long_text, title = strong("Why R you doing this to me?")))
})
}
# Run the application
shinyApp(ui = ui, server = server)
这是现在的样子:
【问题讨论】:
标签: html r text shiny line-breaks