Shiny through R 包中的图像

0 r image shiny

当我在 R 包结构中使用闪亮时,我的图像没有显示。

在我的 R 目录中,我有一个文件 myApp.R,其大纲如下:

@param1
myFunction = function(param1){
  sidebar <- dashboardSidebar(...)
  body <- dashboardBody(...)
  ui <- dashboardPage(...)
  server <- function(input, output, session) { img(src='Figure1.png')}
  shinyApp(ui = ui, server = server)
}
Run Code Online (Sandbox Code Playgroud)

我尝试在 R/www 和 inst/www 中使用 Figure1.png,但是当我运行 myFunction(param1) 时,这两个位置似乎都没有创建数字。它将创建通用应用程序 - 但图像将不存在。

这个问题有简单的解决方法吗?谢谢你。

awc*_*olm 5

尝试函数 addResourcePath("www", "www") 并使用 www/Figure1.png 引用图像

安德鲁