是否将此normalizePath错误与Shiny应用无法返回正确的csv输出有关?

问题描述

我正在制作一个使用pdftools包处理PDF的Shiny应用程序。我收到两个我怀疑已连接的错误。代码如下,然后出现错误:

library(shiny)
library(pdftools)

# Define UI
ui <- fluidPage(
  fluidPage(
    titlePanel("PDF Extractor"),sidebarLayout(
      sidebarPanel(
        fileInput('file1','Choose PDF File'),downloadLink('downloadData','Download')
      ),mainPanel(
        fluidPage(),)
    )
  )
)

# Define server
server <- function(input,output) {
  
  getData <- reactive( {
    
    if (is.null(input$file1))
      return(NULL)
    
  })
  
  output$downloadData <- downloadHandler(
    filename <- function() {
      paste("test-",Sys.time(),".csv",sep = "")
    },content = function(file1) {
          pdf <- file1 #load in file
          pdf_tbl <- pdf_data(pdf) #convert to list of tibbles
          df <- ldply(pdf_tbl,data.frame) #convert list to dataframe
          write.csv(df,file1,row.names = F) #save df as csv
        }
      )
}

# Run the app
shinyApp(ui,server)

错误1:上传PDF并单击“下载”后,应该让我下载PDF数据的csv。 csv应该称为test-SYS.TIME.csv,但我得到的只是downloadData,它是downloadLink参数的outputID。

错误2:Warning: Error in normalizePath: path[1]="C:\Users\USERNAME\AppData\Local\Temp\RtmpUjK1OE\file1f04482ceea.csv": The system cannot find the file specified我在闪亮的应用程序运行时查看了此文件夹,并且确实在其中保存了上载PDF的临时副本,但单击“下载”后并没有保存csv。有other questions处理此特定错误,但未得到令人满意的答复。

那我在做什么错了?

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...