显示非';t存储在R Shining应用程序内的www文件夹中
我想在R Shining应用程序中为不在www文件夹中的pdf创建pdf查看器 在下面的代码中,如果显示非';t存储在R Shining应用程序内的www文件夹中,r,pdf,iframe,shiny,src,R,Pdf,Iframe,Shiny,Src,我想在R Shining应用程序中为不在www文件夹中的pdf创建pdf查看器 在下面的代码中,如果my_path未引用www文件夹,则它似乎不起作用 library(shiny) ui <- fluidPage( uiOutput("PDF_WINDOW") ) server <- function(input, output, session) { output$PDF_WINDOW <- renderUI({ tags$iframe
my_path
未引用www文件夹,则它似乎不起作用
library(shiny)
ui <- fluidPage(
uiOutput("PDF_WINDOW")
)
server <- function(input, output, session) {
output$PDF_WINDOW <- renderUI({
tags$iframe(style="height:485px; width:100%", src= my_path)
})
}
shinyApp(ui, server)
库(闪亮)
ui您需要使包含pdf文件的文件夹可供Web服务器使用。这可以通过addResourcePath
完成:
library(shiny)
my_path <- "/path/to/folder/containing/the/pdf/file"
addResourcePath(prefix = "my_pdf_resource", directoryPath = my_path)
ui <- fluidPage(
uiOutput("PDF_WINDOW")
)
server <- function(input, output, session) {
output$PDF_WINDOW <- renderUI({
tags$iframe(style="height:485px; width:100%", src = "my_pdf_resource/my_pdf_filename.pdf")
})
}
shinyApp(ui, server)
库(闪亮)
我的路太长了!你真是天才!!