【发布时间】:2019-10-25 04:31:28
【问题描述】:
我正在使用以下代码尝试在数据表中显示图像。我无法看到本地图像,主要是因为我显然不了解闪亮的路径。
library(shiny)
library(DT)
library(shinydashboard)
library(here)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(DT::dataTableOutput("test")),
dashboardBody()
)
server <- shinyServer(function(input, output, session) {
dat <- data.frame(
country = c('China', 'Belgium'),
flag = c('<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Flag_of_the_People%27s_Republic_of_China.svg/200px-Flag_of_the_People%27s_Republic_of_China.svg.png" height="52"></img>',
'<img src="/www/EndoMinerLogo.png" height="52"></img>'
)
)
output$test <- DT::renderDataTable({ DT::datatable(dat, escape = F) })
})
shinyApp(ui=ui, server=server)
我的闪亮应用程序文件与文件夹 www 位于同一文件夹中。 (我已经尝试过 /www 和没有“/”
我做错了什么?
【问题讨论】:
-
尝试使用
runApp(PATH)和img src="EndoMinerLogo.png"运行应用程序,... -
好的,很好@BigDataScientist 是的,做到了。文件是否必须始终位于 www 文件夹中?
-
@SebastianZeki
www文件夹将始终有效。您可以使用addResourcePath函数设置另一个文件夹。