【发布时间】:2017-03-23 15:04:48
【问题描述】:
我在闪亮中使用 selectInput,在我选择的下拉菜单中,我希望某些单词之间有多个空格。但是只包含空格不会显示,在应用程序中最多会有一个空格。
例如在下面的代码示例中,我在“Cylinder”和“I”之间有多个空格,但是如果你运行它,只会显示一个 - 我该如何解决这个问题?
ui <- fluidPage(
selectInput("variable", "Variable:",
c("Cylinder I want multiple spaces here" = "cyl",
"Transmission" = "am",
"Gears" = "gear")),
tableOutput("data")
)
server <- function(input, output) {
output$data <- renderTable({
mtcars[, c("mpg", input$variable), drop = FALSE]
}, rownames = TRUE)
}
shinyApp(ui, server)
}
【问题讨论】:
-
我使用
pre()找到了一些带有空格帮助的链接,但是因为在selectInput函数调用中需要额外的空格,所以会更难。该函数接受值并在内部创建 html 代码。如果不深入研究源代码,我就没有办法。希望其他人能有更多的运气。 -
有什么方法可以覆盖 selectInput 之外的标签?
-
那将是一项艰巨的文本解析工作。这是可能的,但不切实际。