我有一个R脚本,通过编译csv文件中的数据,在powerpoint幻灯片上生成各种图形 . 我正在尝试将其转换为一个闪亮的应用程序,在上传csv文件后生成套牌,但无法弄清楚如何在csv文件中读取然后生成pptx下载 .
这是我的用户界面:
ui <- (fluidPage(
titlePanel("Title"),
title = "File Upload",
sidebarLayout(
sidebarPanel(
fileInput("file1", "File1:",
accept = c("text/csv", "text/comma-separated-values,
text/plain", ".csv")),
),
mainPanel(
downloadButton('downloadData', 'Download')
)
)
)
)
而我的服务器功能:
server<- function(input, output,session) {
output$downloadData <- downloadHandler(
data_file <- reactive({
inFile <- input$file1
if (is.null(inFile)) return(NULL)
read.csv(inFile$datapath, na.strings = "null")
}),
filename = "file.pptx",
content = function(file)
当引用本地文件时,代码生成一个套牌 . 当我上传文件时,我收到以下错误 . 我还将数据文件部分移到了下载处理程序之外但没有任何反应 .
警告:downloadHandler中的错误:unused参数(datafile < - reactive({inFile < - input $ file3 if(is.null(inFile))return(NULL)read.csv(inFile $ datapath,na.strings =“null” ))))
有什么建议?