我正在使用renderText我的Shiny Web应用程序中显示一些动态输出.现在我如何在动态输出中包含一个项目符号?
Gui*_*ens 10
假设您正在使用UI.R而不是自定义HTML UI,您应该能够使用HTML函数或tags函数.
请注意,我正在写这篇文章,因此代码未经测试.
HTML("<ul><li>...text...</li><li>...more text...</li></ul>")
Run Code Online (Sandbox Code Playgroud)
要么
tags$div(
tags$ul(
tags$li("text")
)
)
Run Code Online (Sandbox Code Playgroud)
更新:我首先错过了你的问题中的动态词,这就是为什么我只提到UI.R(感谢@StephaneLaurent指出它).
为了使您的项目符号列表动态,您应该renderUI在您的server.R.此函数期望它包装的表达式为HTML.然后,您可以使用指定UI.R放置列表的位置uiOutput.
代码看起来或多或少是这样的:
UI.R
#other elements before the list
uiOutput("myList")
#other elements after the list
Run Code Online (Sandbox Code Playgroud)
server.R
output$myList <- renderUI(HTML("<ul><li>...text...</li><li>...more text...</li></ul>"))
Run Code Online (Sandbox Code Playgroud)
您可以renderUI在文档中找到更多信息,以及在教程中将其用于动态UI的简要说明.