Is there a way to reload input file, which was loaded with fileInput? I would like to allow the user to update his input by simple modification and reloading of csv file. It seems like reloading the file does not update it. One workaround, which helps is to save the modified data with different file name.
I've tried already exchanging fileInput function with an actionButton and file.choose(), but it won't work with R server
Here's my test code:
server.R
shinyServer(function(input, output, session) {
getTestOutput <- reactive({
if(is.null(input$test))
return(NULL)
isolate({
writeLines(paste(input$test, collapse = "\n"))
})
})
getTable <- reactive({
if( is.null(input$test))
return(NULL)
r <- read.csv((input$test)$datapath,sep=";",header = TRUE)
as.data.frame(r)
})
output$testOutput <- renderPrint({
getTestOutput()
})
output$testTable <- renderTable({
if(is.null(getTable()))
return(NULL)
print(getTable())
})
})
ui.R
shinyUI(
fluidPage(
sidebarPanel(
fileInput("test","Load a file")
),
mainPanel(
verbatimTextOutput("testOutput"),
tableOutput('testTable')
)
)
)