I've got an R script that generates various graphs on powerpoint slides by compiling data from a csv file. I'm trying to convert this to a shiny app that generates the deck after uploading a csv file but can't figure out how to read in the csv file and then generate the pptx download.
Here's my UI:
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')
)
)
)
)
And my server function:
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)
When reference a local file, the code generates a deck. When I upload the file,I get the error below. I've also moved the datafile portion outside the download handler but then nothing happens.
Warning: Error in downloadHandler: unused argument (datafile <- reactive({ inFile <- input$file3 if (is.null(inFile)) return(NULL) read.csv(inFile$datapath, na.strings = "null") }))
Any suggestions?