【发布时间】:2021-09-17 09:27:25
【问题描述】:
我想在一个选项中添加一个换行符,因为它太长了。按钮标签有类似的question,但该解决方案对我不起作用,请参见以下代码
ui <- fluidPage(
splitLayout(cellWidths = c(170,80,160),
tagList(uiOutput("example")))
)
server <- function(input, output) {
choices_vector <- c("choice 1","choice 2",HTML("I want a line break here <br/> since the label is too long"),"choice 4")
output$example <- renderUI({
checkboxGroupInput(inputId = "choices_selec",
label = "", choices = choices_vector, selected = F)
})
}
# Run the application
shinyApp(ui = ui, server = server)
我也尝试使用 paste0 和 collapse(参见以下代码)并将 uiOutput 更改为 htmlOutput,但结果相同
server <- function(input, output) {
choices_vector <- c("choice 1","choice 2",paste0(c("I want a line break here ", "since the label is too long"), collapse = "<p/>"),"choice 4")
output$example <- renderUI({
checkboxGroupInput(inputId = "choices_selec",
label = "", choices = choices_vector, selected = F)
})
}
任何帮助将不胜感激,谢谢!
【问题讨论】: