【发布时间】:2020-06-12 10:58:14
【问题描述】:
我使用 shinydashboard 构建了一个应用程序,并尝试生成一个带有(反应性)文本的框。我在dashboardBody 中的代码是
box("Species was found in ", textOutput("Count1"), "of", Count2, "Sites")
Count1 是响应式的,基于 UI 中的用户输入。 Count2 在 global.R 中定义。
输出是:
Species was found in
1
of 134 Sites
那么,如何删除换行符? paste() 不起作用,因为它只显示 textoutput 元素的 html 代码。
【问题讨论】:
-
我认为使用
paste可以满足您的要求:box(paste("Species was found in", textOutput("Count1"), "of", Count2, "Sites")) -
正如我所写的 paste() 产生:
Species was found in <div id="Count1" class="shiny-text-output"></div> of 134 Sites -
cat( )函数在这里可能会有所帮助。 -
不,这会产生:
ERROR: argument 1 (type 'list') cannot be handled by 'cat' -
textOutput("Count1", inline = TRUE)能帮到你吗?
标签: r shiny line break shinydashboard